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