- 978 名前:デフォルトの名無しさん mailto:sage [2007/07/26(木) 18:17:28 ]
- // >>974
#include <stdio.h> #include <string.h> #include <stdbool.h> bool isPalindrome(const char * word) { unsigned len = strlen(word); if (len == 0) return false; for (unsigned ic = 0; ic < len / 2; ++ic) { if (word[ic] != word[len - 1 - ic]) return false; } return true; } int main() { char buf[200]; scanf("%199[^\n]", buf); printf("%s is%s palindrome.\n", buf, isPalindrome(buf) ? "" : " not"); return 0; }
|

|