fork(1) download
  1. <?php
  2.  
  3.  
  4. $text = "А роза упала на лапу Азора";
  5.  
  6. $text = mb_strtolower($text);
  7. $text = str_replace(" ","",$text);
  8.  
  9. $length = mb_strlen($text);
  10. $halfLength = floor($length/2);
  11. $a = -1;
  12. for ($i = 0; $i <= $halfLength; $i++) {
  13. if (mb_substr($text,$i,1) == mb_substr($text,$a,1)) {
  14. $result = "YES";
  15. }
  16. else if (mb_substr($text,$i,1) != mb_substr($text,$a,1)) {
  17. $result = "NO";
  18. break;
  19. }
  20. $a=$a-1;
  21. }
  22. echo $result;
  23.  
Success #stdin #stdout 0s 52488KB
stdin
Standard input is empty
stdout
YES