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