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