0
点赞
收藏
分享

微信扫一扫

回文字符串

root no
roor yes

#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;

int main()
{
    int n, i;
    char str[20];
    gets(str);
    n = strlen(str);
    for(i = 0; i < n / 2; i++)
        if(str[i] != str[n - i - 1])
            break;
    if(i == n / 2)
        cout<<"yes";
    else
        cout<<"no";
    return 0;

}
举报

相关推荐

0 条评论