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