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