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