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