fork(1) download
  1. # include <stdio.h>
  2.  
  3. int isPalindrome(char s[]){
  4. int i=0, j;
  5. for(j=0;s[j+1]!=0;j++);
  6. while(i<=j){
  7. if(s[i++]!=s[j--]) return 0;
  8. }
  9. return 1;
  10. }
  11.  
  12. int main(){
  13. char s[100];
  14. gets(s);
  15. printf("%s -> %d\n",s,isPalindrome(s));
  16. return 0;
  17. }
  18.  
Success #stdin #stdout 0s 5376KB
stdin
1234 3245 9876 6789 5423 4321
 
stdout
1234 3245 9876 6789 5423 4321 -> 1