fork download
  1. # include <stdio.h>
  2.  
  3. int isPalindrome(char s[]){
  4. int left=0;
  5. int right=strlen(s)-1;
  6.  
  7. while(left<right){
  8. if(s[left]!=s[right]){
  9. return 0;
  10. }
  11. left++;
  12. right--;
  13. }
  14. return 1;
  15.  
  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 5304KB
stdin
Standard input is empty
stdout
 -> 1