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