fork download
  1. # include <stdio.h>
  2.  
  3. int isPalindrome(char s[]){
  4. int count=0;
  5. while(s[count]!='\0'){
  6. count++;
  7. }
  8.  
  9. int left=0;
  10. int right=count-1;
  11. while(left<right){
  12. if(s[left]!=s[right]){
  13. return 0;
  14. }
  15. left++;
  16. right--;
  17. }
  18. return 1;
  19. }
  20.  
  21.  
  22. int main(){
  23. char s[100];
  24. scanf("%s",s);
  25. printf("%s -> %d\n",s,isPalindrome(s));
  26. return 0;
  27. }
  28.  
Success #stdin #stdout 0s 5320KB
stdin
abbbbbbac
stdout
abbbbbbac -> 0