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