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