1 #include<bits/stdc++.h>
2 #define Mp make_pair
3 #define F first
4 #define S second
5 using namespace std;
6 const int N = 1e6+7;
7 const int M1 = 1e9+7 , M2 = 1e9+9;
8 typedef long long ll;
9 typedef struct Node{
10 long long first ,second;
11
12 Node (){}
13 Node ( ll u,ll v){ first = u , second = v ;}
14 }PII;
15 //typedef pair<ll,ll> PII;
16
17 const PII base{M2,M1},p{M1,M2},One{1ll,1ll},Zero{0ll,0ll};
18
19 PII operator - (PII u,PII v){
20 return Node( (u.first-v.first+p.first)%p.first ,(u.second-v.second+p.second)%p.second );
21 }
22 PII operator * ( PII u , PII v ){
23 return Node( (u.first*v.first)%p.first , (u.second*v.second)%p.second );
24 }
25 PII operator + ( PII u , PII v ){
26 return Node( (u.first+v.first)%p.first , (u.second+v.second)%p.second );
27 }
28 PII operator + ( PII u , int v ){
29 return Node( (u.first+v)%p.first , (u.second+v)%p.second );
30 }
31 bool operator != ( PII u,PII v ){
32 return !( u.first == v.first && u.second == v.second );
33 }
34 bool operator == ( PII u,PII v ){
35 return ( u.first == v.first && u.second == v.second );
36 }
37 PII Pow( PII a ,int b){
38 PII ans = One ;
39 while( b ){
40 if( b&1 )
41 ans = ans * a ;
42 b >>= 1 ;
43 a = a * a ;
44 }
45 return ans ;
46 }
47 PII sum[N];
48 char str[N];
49 int ans[N];
50 int main()
51 {
52 ios_base :: sync_with_stdio(0);
53 cin.tie(NULL),cout.tie(NULL);
54
55 while( cin >> str+1 ){
56 if( str[1] == ‘.‘) break;
57 int len = strlen(str+1);
58 int n = len ;
59 sum[n+1] = Zero ;
60 for(int i=len;i>=1;i--)
61 sum[i] = sum[i+1] * base + str[i] ;
62 int cnt = 0 ;
63 /*
64 for(int i=1;i<=n;i++){
65 printf("%lld %lld \n",sum[i].first,sum[i].second);
66 }
67 */
68 PII P = base ;
69 for(int i=n-1;i>=1;i--){
70 //printf("#### %d \n",i);
71 if( sum[1] - sum[1+i] == P * sum[n-i+1] ){
72 ans[cnt++] = n-i ;
73 }
74 P = P * base ;
75 //printf("%lld * %lld = %lld \n ",sum[i].first,Pow(base,n-i-1).first ,(sum[n]-sum[n-i]).first );
76 }
77 //sort( ans , ans + cnt );
78 for(int i=0;i<cnt;i++){
79 cout << ans[i] << ‘ ‘;
80 }
81 cout << n << endl;
82 //cout << ans << endl ;
83 }
84 return 0;
85 }
86