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