fork download
  1. <?php
  2. $input = trim(fgets(STDIN));
  3. $originalInput = $input;
  4. $numberOfDigits = strlen(strval($input));
  5. $resevedNum = "";
  6. for ($i = 1; $i <= $numberOfDigits; $i++) {
  7. $res = $input % 10;
  8. if ($res != 0) {
  9. $resevedNum .= $res;
  10. }
  11. $input = (int) ($input / 10);
  12.  
  13. }
  14. echo $resevedNum . "\n";
  15. if ($resevedNum == $originalInput) {
  16. echo "YES";
  17. } else {
  18. echo "NO";
  19. }
Success #stdin #stdout 0.02s 25896KB
stdin
160
stdout
61
NO