Result: Accepted
Time: 5ms
Memory: 1756kB
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<string>
using namespace std;
int T,i,f;
string s;
int check(string s){
for(int i=0,j=s.length()-1;i<=j;i++,j--){
if(s[i]!=s[j]) return 0;
}
return 1;
}
int main(){
scanf("%d",&T);
while(T--){
cin>>s;
f=check(s);
for(i=0;i<s.length();i++){
if(f==1) break;
string s1=s;
s1.erase(i,1);
if(check(s1)==1) f=1;
}
if(f==1) printf("Yes\n");
else printf("No\n");
}
}