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