fork download
  1. #include <stdio.h>
  2.  
  3. int isPalindrome(char s[]){
  4. char t[100];
  5. int count=0;
  6. for(int i=0;s[i]!='\0';i++){
  7. count++;
  8. }
  9. for(int i=0;s[i]==s[count-1-i];i--){
  10. if(s[i]=='\0'){
  11. return 1;
  12. }
  13. }
  14. return 0;
  15. //関数の中だけを書き換えてください
  16. //回文になっているとき1を返す
  17. //回文になっていないとき0を返す
  18. }
  19.  
  20. //メイン関数は書き換えなくてよいです
  21. int main(){
  22. char s[100];
  23. scanf("%s",s);
  24. printf("%s -> %d\n",s,isPalindrome(s));
  25. return 0;
  26. }
Success #stdin #stdout 0s 5320KB
stdin
repaper
stdout
repaper -> 1