#include<stdio.h>
#include<string.h>
const int maxn=100;
int judge(char s[])
{int len=strlen(s);int flag=1;//若flag为1则是回文串 for(int i=0;i<len/2;i++){if(s[i]!=s[len-i-1]){flag=0;}}return flag;
}
int main()
{char s[maxn];while(gets(s))//输入字符串 {int flag=judge(s);if(flag==1){printf("YES\n");} else{printf("NO\n");}}return 0;
}
1009 说反话 (20分)
#include<stdio.h>
#include<string.h>
const int maxn=81;int main()
{char s[81];gets(s);//输入字符串int len=strlen(s);char a[81][81];int r=0,h=0;//r为行,h为列 for(int i=0;i<len;i++){if(s[i]!=' '){a[r][h++]=s[i];}else{//如果是空格则说明一个单词结束,行加一,列归零 a[r][h]='\0';r++;h=0;}}for(int i=r;i>=0;i--){printf("%s",a[i]);if(i>0){printf(" ");}} return 0;
}