百练oj1192
-
题目描述:
-
给出一个长度不超过1000的字符串,判断它是不是回文(顺读,逆读均相同)的。
-
输入:
-
输入包括一行字符串,其长度不超过1000。
-
输出:
-
可能有多组测试数据,对于每组数据,如果是回文字符串则输出"Yes!”,否则输出"No!"。
-
样例输入:
-
hellolleh helloworld
-
样例输出:
-
Yes! No!
#include<stdio.h>
#include<string.h>
int main()
{
int i,j,n;
char c[1001];
while(gets(c)!=NULL)
{
n=strlen(c);
for(i=0;i<n;i++)
if(c[i]!=c[n-i-1])
break;
if(i==n)
printf("Yes!\n");
else
printf("No!\n");
}
return 0;
}