Start: Jun, 30, 2019 09:00:00
2019年度暑期短学期第十天 助教场
End: Jul, 08, 2019 23:59:00
Time elapsed:
Time remaining:

Problem_ID: F
Result: Accepted
Time: 6ms
Memory: 1760kB
Author: 2018212212174
In contest: 1290

#include <bits/stdc++.h>
using namespace std;
char str[1100], brr[1100] ;
bool judge(char brr[], int len)
{
	for(int i = 0 ; i < len / 2 ; ++ i)
	{
		if(brr[i] != brr[len- i - 1])
		{
			return 0 ;
		}
	}
	return 1 ;
}
int main(int argc, char const *argv[])
{
	int t ;
	scanf("%d",&t) ;
	getchar() ;
	while(t --)
	{
		int flag = 0 ;
		int flag1 = 0 ;
		scanf("%s",str) ;
		int len = strlen(str) ;
		for(int i = 0 ; i < len / 2 ; ++ i)
		{
			if(str[i] != str[len- i - 1])
			{
				flag1 = 1 ;
			}
		}
		if(flag1 == 0)
		{
			printf("Yes\n") ;
			continue ;
		}
		for(int i = 0 ; i < len ; ++ i)
		{
			for(int j = 0, cnt = 0 ; j < len ; ++ j)
			{
				if(j == i) continue ;
				brr[cnt ++ ] = str[j] ;
			}
			if(judge(brr,len-1))
			{
				printf("Yes\n") ;
				flag = 1 ;
				break ;
			}
		}
		if(flag == 0)
			printf("No\n") ;
	}
	
	return 0;
}