回文串判定
Time Limit: 1000MS Memory Limit: 65536KB
Problem Description
输入一串字符(长度小于100),判断该串字符是否是回文串(正序读与逆序读内容相同)。
Input
输入一串字符(长度小于100)。
Output
若该串字符是回文串输出“yes",否则输出”no“。
Example Input
asdfgfdsa
Example Output
yes
#include<stdio.h>
#include<string.h>
int main()
{
char a[100],b[100];
int o = 0;
gets(a);
for (int i = strlen(a) - 1; i >= 0; i--)
{
b[o++] = a[i];
}
b[o] = '\0';
if (strcmp(a,b) == 0)
printf("yes\n");
else
printf("no\n");
}