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

#include<bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
int jud(char p[],int x) {
	int k = strlen(p)-1;
	for (int i = 0; ; i++) {
		if (i > k)break;
		if (i == x)continue;
		else if (k == x) {
			k--, i--; continue;
	    }
		if (p[i] == p[k])k--;
		else return 0;
	}
	return 1;
}
int main() {
	int t;
	cin >> t;
	while (t--) {
		char p[1100];
		cin >> p;
		int is = 0;
		if (jud(p, inf) == 1) {
			printf("Yes\n");
			continue;
	    }
		for (int i = 0; i < strlen(p); i++) {
			if (jud(p, i) == 1) {
				printf("Yes\n");
				is = 1;
				break;
			}
		}
		if (!is)printf("No\n");
	}
	return 0;
}