Result: Accepted
Time: 5ms
Memory: 1756kB
#include <bits/stdc++.h>
using namespace std;
string str;
bool judge(string s) {
for (int i = 0, j = s.length() - 1; i <= j; ++i, --j) {
if (s[i] != s[j]) {
return false;
}
}
return true;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
int t;
cin >> t;
while (t--) {
cin >> str;
int flag = judge(str);
for (int i = 0, len = str.length(); i < len; ++i) {
if (flag) {
break;
}
string Str = str;
Str.erase(i, 1);
if (judge(Str)) {
flag = 1;
}
}
cout << (flag ? "Yes\n" : "No\n");
}
return 0;
}