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