Description
输入一串字符(长度小于100),判断该串字符是否是回文串(正序读与逆序读内容相同)。
Input
输入一串字符(长度小于100)。
Output
若该串字符是回文串输出“yes",否则输出”no“。
Sample
Input
asdfgfdsa
Output
yes
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
int main(){
char str[101], a[101];
int l, i, n = 0;
gets(str);
l = strlen(str);
for(i = l - 1; i >= 0; i--){
a[n] = str[i];
n++;
}
a[n] = '\0';
if(strcmp(str, a) == 0){
printf("yes\n");
}
else{
printf("no\n");
}
return 0;
}