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