fork download
  1. # include <stdio.h>
  2.  
  3. int isPalindrome(char s[]){
  4. int i,j,res=1;
  5. for(i=0;s[i]!='\0';i++);
  6. for(j=0;j<=i/2;j++){
  7. if(s[j]!=s[i-j-1]){
  8. res=0;
  9. }
  10. }
  11. return res;
  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 5276KB
stdin
girafarigs
stdout
girafarigs -> 0