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