#include<iostream>
#include<string>
using namespace std;
int main(){
int n, length;
string str;
cin >> n;
getchar();
while (n){
int num = 0;
getline(cin, str);
length = str.length();
//回文循环字符串一半长度即可
for (int i = 0; i < length / 2; i++){
//判断对应位置字符相等
if (str[i] == str[length - i - 1])
num++;
//else break; //开始ac不了问题出在这里,后来发现加上这句如果只输入一个字符,会死循环输出yes
}
//cout << num << endl;
if (num == length / 2)
cout << "yes" << endl;
else cout << "no" << endl;
n--;
}
return 0;
}
杭电ACM2029:回文判断简单版
最新推荐文章于 2021-05-17 12:41:45 发布