#include <stdio.h>
int isPalindrome(char s[]) {
int a = 0;
int b = 0;
// 文字列の終端を探す
while (s[b] != '\0') {
b++;
}
b--; // 終端文字('\0')の前のインデックスに戻す
// 回文かどうかを確認
while (a < b) {
if (s[a] != s[b]) {
return 0; // 回文ではない
}
a++;
b--;
}
return 1; // 回文である
}
int main() {
char s[100];
printf("%s -> %d\n", s
, isPalindrome
(s
)); return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgppbnQgaXNQYWxpbmRyb21lKGNoYXIgc1tdKSB7CiAgICBpbnQgYSA9IDA7CiAgICBpbnQgYiA9IDA7CgogICAgLy8g5paH5a2X5YiX44Gu57WC56uv44KS5o6i44GZCiAgICB3aGlsZSAoc1tiXSAhPSAnXDAnKSB7CiAgICAgICAgYisrOwogICAgfQogICAgYi0tOyAvLyDntYLnq6/mloflrZcoJ1wwJynjga7liY3jga7jgqTjg7Pjg4fjg4Pjgq/jgrnjgavmiLvjgZkKCiAgICAvLyDlm57mlofjgYvjganjgYbjgYvjgpLnorroqo0KICAgIHdoaWxlIChhIDwgYikgewogICAgICAgIGlmIChzW2FdICE9IHNbYl0pIHsKICAgICAgICAgICAgcmV0dXJuIDA7IC8vIOWbnuaWh+OBp+OBr+OBquOBhAogICAgICAgIH0KICAgICAgICBhKys7CiAgICAgICAgYi0tOwogICAgfQoKICAgIHJldHVybiAxOyAvLyDlm57mlofjgafjgYLjgosKfQoKaW50IG1haW4oKSB7CiAgICBjaGFyIHNbMTAwXTsKICAgIHNjYW5mKCIlcyIsIHMpOwogICAgcHJpbnRmKCIlcyAtPiAlZFxuIiwgcywgaXNQYWxpbmRyb21lKHMpKTsKICAgIHJldHVybiAwOwp9Cg==