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(s[i]<=s[j]){
  7. if(s[i++]!=s[j--]){
  8. return 0;
  9. }
  10. }
  11. }
  12. return 1;
  13. }
  14.  
  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 5320KB
stdin
girafarig
stdout
girafarig -> 0