首页 > 试题广场 >

#include #include <...

[填空题]
#include <stdio.h>
#include <string.h>

const int SIZE = 100;

int main( ) {
    int n, i, isPlalindrome;
    char str[SIZE];
    scanf("%s", str);
    n = strlen(str);
    isPlalindrome = 1;
    for (i = 0; i < n / 2; i++) {
        if (str[i] != str[n - i - 1]) isPlalindrome = 0;
    }
    if (isPlalindrome)
        printf("Yes\n");
    else
        printf("No\n");
    return 0;
}

输入:abceecba
输出:_____1_____

判断是否为回文串
发表于 2019-10-18 14:44:25 回复(0)