fork download
  1. # include <stdio.h>
  2.  
  3. int isPalindrome(char s[]){
  4. int i=0;
  5. int j;
  6. for(j=0;s[j+1]!='\0';j++)
  7. ;
  8. while(i<=j){
  9. if(s[i++]!=s[j--])
  10. return 0;
  11. }
  12. return 1;
  13. //関数の中だけを書き換えてくださ
  14. //回文になっているとき1を返す
  15. //回文になっていないとき0を返す
  16. }
  17.  
  18. //メイン関数は書き換えなくてよいです
  19. int main(){
  20. char s[100];
  21. scanf("%s",s);
  22. printf("%s -> %d\n",s,isPalindrome(s));
  23. return 0;
  24. }
  25.  
Success #stdin #stdout 0s 5312KB
stdin
girafarig
stdout
girafarig -> 1