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