#include #include #include #include #include #include #include #include using namespace std; #include #include #include #include #include #include #include #pragma comment(linker, "/STACK:1024000000,1024000000") #define clc(arr, val) memset(arr, val, sizeof(arr)) #define FOR(i,a,b) for(int i=a;i<=b;i++) #define IN freopen ("in.txt" , "r" , stdin); #define OUT freopen ("out.txt" , "w" , stdout); typedef long long LL; typedef unsigned long long ULL; const int MAXN = 120000; const int MAXM = 6000010; const int INF = 0x3f3f3f3f; const LL mod = (LL)1<<32; const double eps= 1e-8; const double pi=acos(-1.0); #define lson l,m, rt<<1 #define rson m+1,r,rt<<1|1 char s[220010],c[220100]; int p[220100]; int solve() { int len=strlen(s); c[0]='$'; for(int i=0;ii) p[i]=min(p[id*2-i],p[id]+id-i); else p[i]=1; while(c[i+p[i]]==c[i-p[i]]) p[i]++; if(i+p[i]>mx) mx=i+p[i],id=i; } for(int i=2;ii+p[i]) continue; int xx=j-(i+p[i]); int last=(len-(j+xx))/2+j+xx; if(last<=len-2&&last+p[last]==len) { return 1; } } } return 0; } /* 2 abccba */ int main() { int t; scanf("%d",&t); while(t--) { scanf("%s",s); if(solve()) puts("Yes"); else puts("No"); } return 0; } /* 13 214 1471471471477 */