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