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