#include<bits/stdc++.h>
using namespace std;
const int N = 1e6 + 9;
char s[N << 1];
int t;
int p[N << 1],len,len2;
bool ans[N << 1];
void read(){
char c = getchar();
len = 1;len2 = 0;
s[0] = '~';s[len] = '|';
while(c < 'a' || c > 'z')
c = getchar();
while(c >= 'a' && c <= 'z'){
s[++len] = c;len2++;
s[++len] = '|';
c = getchar();
}
}
int main(){
scanf("%d", &t);
while(t--){
read();
memset(ans,0,sizeof ans);
for(int i = 1,mx = 0,id = 0;i <= len;i++){
p[i] = i <= mx ? min(p[(id << 1) - i],mx - i + 1) : 1;
while(s[i - p[i]] == s[i + p[i]]){
++p[i];
if(p[i] + i > mx){
mx = p[i] + i - 1;
id = i;
}
}
}
for(int i = len2;i >= 1;i--){
int P = p[i << 1];
if(P > 1){
P >>= 1;P--;
if(i + P == len2)
ans[i] = true;
if(ans[i + P] && i - P == 1)
ans[i] = true;
}
}
for(int i = 1;i <= len;i++)
if(ans[i])
printf("%d ",i);
putchar('\n');
}
return 0;
}