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