fork download
  1. # include <stdio.h>
  2.  
  3. int isPalindrome(char s[]){
  4. char s2[100];
  5. int i,j;
  6. for (j = 0; s[j] != '\0'; j++);
  7.  
  8. for (i = 0;i<j; i++){
  9. s2[i] = s[i];
  10. s2[j] = '\0';
  11. }
  12. for (i = 0; s[i] != '\0'; i++){
  13. if(s[i]!=s2[j-i-1]){
  14. return 0;}
  15. }
  16. return 1;
  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 0s 5320KB
stdin
girafarig
stdout
girafarig -> 1