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