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