fork download
  1. # include <stdio.h>
  2.  
  3. int isPalindrome(char s[]){
  4. int i=0,j;
  5. for(j=0;s[j+1]!='\0';j++){
  6. ;
  7. }
  8. while(i<=j){
  9. if(s[i++]!=s[j--]){
  10. return 0;
  11. }
  12. return 1;
  13. }
  14.  
  15. //関数の中だけを書き換えてください
  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 5324KB
stdin
girafarig
stdout
girafarig -> 1