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