fork download
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int isPalindrome(char s[]){
  5. int left = 0;
  6. int right = strlen(s) - 1;
  7.  
  8. while(left < right){
  9. if(s[left] != s[right]){
  10. return 0;
  11. }
  12. left++;
  13. right--;
  14. }
  15. return 1;
  16. }
  17.  
  18. int main(){
  19. char s[100];
  20. scanf("%s", s);
  21.  
  22. printf("%d\n", isPalindrome(s));
  23.  
  24. return 0;
  25. }
Success #stdin #stdout 0s 5320KB
stdin
repaper
stdout
1