# include <stdio.h>
int isPalindrome(char s[]){
int wordNum = 0;
char p[100];
while(s[wordNum]!='\0')
{
wordNum++;
}
// printf("wordNum = %d\n", wordNum);
for(int i = 0; i < wordNum; i++)
{
p[i] = s[wordNum - i - 1];
}
p[wordNum]='c';
// int wordNum_p = 0;
// while(p[wordNum_p]!='\0')
// {
// wordNum_p++;
// }
// printf("wordNum_p = %d\n", wordNum_p);
//printf("%s, %s\n", s, p);
for(int n = 0; s[n] == p[n]; n++)
{
if(s[n] == '\0')
return 1;
}
return 0;
}
//メイン関数は書き換えなくてよいです
int main(){
char s[100];
printf("%s -> %d\n",s
,isPalindrome
(s
)); return 0;
}
IyBpbmNsdWRlIDxzdGRpby5oPgoKaW50IGlzUGFsaW5kcm9tZShjaGFyIHNbXSl7CgoJaW50IHdvcmROdW0gPSAwOwoJY2hhciBwWzEwMF07CgkKCXdoaWxlKHNbd29yZE51bV0hPSdcMCcpCgl7CgkJd29yZE51bSsrOwoJfQoJCQovLwlwcmludGYoIndvcmROdW0gPSAlZFxuIiwgd29yZE51bSk7CgkKCWZvcihpbnQgaSA9IDA7IGkgPCB3b3JkTnVtOyBpKyspCgl7CgkJcFtpXSA9IHNbd29yZE51bSAtIGkgLSAxXTsKCX0KCXBbd29yZE51bV09J2MnOwoJLy8gaW50IHdvcmROdW1fcCA9IDA7CgkvLyB3aGlsZShwW3dvcmROdW1fcF0hPSdcMCcpCgkvLyB7CgkvLyAJd29yZE51bV9wKys7CgkvLyB9CgkvLyBwcmludGYoIndvcmROdW1fcCA9ICVkXG4iLCB3b3JkTnVtX3ApOwoJCgkvL3ByaW50ZigiJXMsICVzXG4iLCBzLCBwKTsKCQoJZm9yKGludCBuID0gMDsgc1tuXSA9PSBwW25dOyBuKyspCgl7CgkJaWYoc1tuXSA9PSAnXDAnKQoJCXJldHVybiAxOwoJfQoJcmV0dXJuIDA7Cgp9CgovL+ODoeOCpOODs+mWouaVsOOBr+abuOOBjeaPm+OBiOOBquOBj+OBpuOCiOOBhOOBp+OBmQppbnQgbWFpbigpewogICAgY2hhciBzWzEwMF07CiAgICBzY2FuZigiJXMiLHMpOwogICAgcHJpbnRmKCIlcyAtPiAlZFxuIixzLGlzUGFsaW5kcm9tZShzKSk7CiAgICByZXR1cm4gMDsKfQo=