#include <stdio.h>
#include<string.h>
#include<stdlib.h>
int judge(char *s)
{//判断字符串是否是回文串
int len = strlen(s);
int i=0,j=len-1;
for(i=0,j=len-1;s[i]==s[j]&&i<j;i++,j--);
if(j<=i) return 1;
else return 0;
}
int main()
{
char *s=(char*)malloc(sizeof(char)*100);
int cnt=0;
while(scanf("%s", s)!=EOF)
{
cnt++;
if(judge(s))
printf("case%d: yes\n", cnt);
else
printf("case%d: no\n", cnt);
}
return 0;
}
2013判断回文字符串
猜你喜欢
转载自blog.csdn.net/qq_43661234/article/details/103864079
今日推荐
周排行