12345678910111213141516171819202122232425262728 |
- #include <stdio.h>
- #include <string.h>
- int main() {
- char sentence[51]; // 句子最大长度不超过50
- scanf("%s", sentence);
- int length = strlen(sentence);
- int is_palindrome = 1;
- // 判断是否是回文
- int i;
- for (i = 0; i < length / 2; i++) {
- if (sentence[i] != sentence[length - 1 - i]) {
- is_palindrome = 0;
- break;
- }
- }
- // 输出结果
- if (is_palindrome) {
- printf("Yes\n");
- } else {
- printf("No\n");
- }
- return 0;
- }
|