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: 5ms
Memory: 1756kB
Author: 2018212212246
In contest: 1290

#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<string>
using namespace std;
int main() 
{
	int n;
	string s, tmp;
	cin >> n;
	while (n--) 
	{
		cin >> s;
		bool mark = false;
		for (int i = 0; i < s.size() / 2; i++) 
			if (s[i] != s[s.size() - 1 - i]) 
			{
				mark = true;
				break;
			}
		if (!mark)
			printf("Yes\n");
		else 
		{
			bool tag = false;
			for (int i = 0; i < s.size(); i++)
			{
				bool flag = true;
				tmp = s;
				tmp.erase(i, 1);
				int len = tmp.size();
				for (int j = 0; j < len / 2; j++)
					if (tmp[j] != tmp[len - 1 - j])
					{
						flag = false;
						break;
					}
				if (flag)
				{
					tag = true;
					printf("Yes\n");
					break;
				}
			}
			if (!tag)
				printf("No\n");
		}
	}
	return 0;
}