fork download
  1. # include <stdio.h>
  2. # include <ctype.h>
  3.  
  4. int isPalindrome(char s[]){
  5. int i=0, count=0;
  6. char copy[100],dec[100];
  7. while(s[i] != '\0'){
  8. copy[i] = tolower(s[i]);
  9. i++;
  10. }
  11. copy[i] = '\0';
  12. count = i;
  13. for(i=0; i<count; i--){
  14. dec[i] = copy[count - i - 1];
  15. }
  16. dec[count] = '\0';
  17. for(i=0; i<count; i++){
  18. if(copy[i] != dec[i])return 0;
  19. }
  20. return 1;
  21. }
  22. int main(){
  23. char s[100];
  24. scanf("%s",s);
  25. printf("%s -> %d\n",s,isPalindrome(s));
  26. return 0;
  27. }
Success #stdin #stdout 0s 5280KB
stdin
girafarig
stdout
girafarig -> 1