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