#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <utility>
#include <string.h>
#include <string>
#include <math.h>
#include <stack>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <iterator>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <bitset>
#include <time.h>
#include <stdlib.h>
#include <numeric>
using namespace std;
const long long INF = 1ll << 32;
const double PI = acos(-1);
const int MOD_VAL = 998244353;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<vi> vvi;
typedef vector<vb> vvb;
typedef vector<vl> vvl;
typedef vector<vpi> vvpi;
typedef vector<string> vs;
typedef vector <vector<string>> vvs;
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define read(v) for (int it = 0; it < v.size(); it++) {scanf("%d", &v[it]);}
#define print(v) for(auto it : v) printf("%d ", (int)it); puts("");
#define readL(v) for (int it = 0; it < v.size(); it++) scanf("%lld", &v[it]);
#define printL(v) for (auto it : v) printf("%lld ", it); puts("");
#define readC(v) for (int it = 0; it < v.size(); it++) {scanf(" %c", &v[it]);}
#define printC(v) for(auto it : v) printf("%c ", it); puts("");
#define IShowSpeed ios::sync_with_stdio(false),cin.tie(nullptr);
#define oo 1000000007
void solve() {
string S;
cin >> S;
int N = S.size();
const ll base1 = 911, mod1 = 1000000007;
const ll base2 = 3571, mod2 = 1000000009;
vector<ll> h1(N+1, 0), h2(N+1, 0);
vector<ll> p1(N+1, 1), p2(N+1, 1);
for(int i=0;i<N;i++){
h1[i+1] = (h1[i] * base1 + (S[i]-'a' +1)) % mod1;
h2[i+1] = (h2[i] * base2 + (S[i]-'a' +1)) % mod2;
p1[i+1] = p1[i] * base1 % mod1;
p2[i+1] = p2[i] * base2 % mod2;
}
vector<int> ans(N+1, N+1);
for(int len=1; len<=N; len++){
vector<pair<ll, int>> lst;
for(int l=0; l + len <= N; l++) {
ll ha = (h1[l + len] - h1[l] * p1[len] % mod1 + mod1) % mod1;
ll hb = (h2[l + len] - h2[l] * p2[len] % mod2 + mod2) % mod2;
ll key = ha * 1ll * mod2 + hb;
lst.emplace_back(key, l);
}
sort(all(lst));
for(auto&it:lst)
cout<<it.first<<" "<<it.second<<endl;
cout<<endl;
int m = lst.size();
int i =0;
while(i <m){
ll key = lst[i].first;
int j =i;
while(j <m && lst[j].first == key) j++;
vector<int> ls;
for(int t=i;t<j;t++) ls.push_back(lst[t].second);
sort(all(ls));
int cnt=0, ce=-1;
for(auto l: ls){
int s = l;
int e = l + len -2;
if(s > ce +1){
cnt += (e -s +1);
ce = e;
}
else{
if(e > ce){
cnt += (e - ce);
ce = e;
}
}
}
int k = N - cnt;
if(k >=1 && k <=N){
ans[k] = min(ans[k], len);
}
i =j;
}
}
for(int k=1; k<=N; k++) printf("%d ", (ans[k] <=N)? ans[k] :0);
puts("");
}
int main(void) {
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
#endif
int t =1;
while(t--)
solve();
return 0;
}
I2RlZmluZSBfQ1JUX1NFQ1VSRV9OT19XQVJOSU5HUwojaW5jbHVkZSA8aW9zdHJlYW0+CiNpbmNsdWRlIDx1dGlsaXR5PgojaW5jbHVkZSA8c3RyaW5nLmg+CiNpbmNsdWRlIDxzdHJpbmc+CiNpbmNsdWRlIDxtYXRoLmg+CiNpbmNsdWRlIDxzdGFjaz4KI2luY2x1ZGUgPHNldD4KI2luY2x1ZGUgPG1hcD4KI2luY2x1ZGUgPHF1ZXVlPgojaW5jbHVkZSA8ZGVxdWU+CiNpbmNsdWRlIDxpdGVyYXRvcj4KI2luY2x1ZGUgPHZlY3Rvcj4KI2luY2x1ZGUgPGFsZ29yaXRobT4KI2luY2x1ZGUgPHVub3JkZXJlZF9tYXA+CiNpbmNsdWRlIDxiaXRzZXQ+CiNpbmNsdWRlIDx0aW1lLmg+CiNpbmNsdWRl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ICAgfQogICAgdmVjdG9yPGludD4gYW5zKE4rMSwgTisxKTsKICAgIGZvcihpbnQgbGVuPTE7IGxlbjw9TjsgbGVuKyspewogICAgICAgIHZlY3RvcjxwYWlyPGxsLCBpbnQ+PiBsc3Q7CiAgICAgICAgZm9yKGludCBsPTA7IGwgKyBsZW4gPD0gTjsgbCsrKSB7CiAgICAgICAgICAgIGxsIGhhID0gKGgxW2wgKyBsZW5dIC0gaDFbbF0gKiBwMVtsZW5dICUgbW9kMSArIG1vZDEpICUgbW9kMTsKICAgICAgICAgICAgbGwgaGIgPSAoaDJbbCArIGxlbl0gLSBoMltsXSAqIHAyW2xlbl0gJSBtb2QyICsgbW9kMikgJSBtb2QyOwogICAgICAgICAgICBsbCBrZXkgPSBoYSAqIDFsbCAqIG1vZDIgKyBoYjsKICAgICAgICAgICAgbHN0LmVtcGxhY2VfYmFjayhrZXksIGwpOwogICAgICAgIH0KICAgICAgICBzb3J0KGFsbChsc3QpKTsKICAgICAgICBmb3IoYXV0byZpdDpsc3QpCiAgICAgICAgY291dDw8aXQuZmlyc3Q8PCIgIjw8aXQuc2Vjb25kPDxlbmRsOwogICAgICAgIGNvdXQ8PGVuZGw7CiAgICAgICAgaW50IG0gPSBsc3Quc2l6ZSgpOwogICAgICAgIGludCBpID0wOwogICAgICAgIHdoaWxlKGkgPG0pewogICAgICAgICAgICBsbCBrZXkgPSBsc3RbaV0uZmlyc3Q7CiAgICAgICAgICAgIGludCBqID1pOwogICAgICAgICAgICB3aGlsZShqIDxtICYmIGxzdFtqXS5maXJzdCA9PSBrZXkpIGorKzsKICAgICAgICAgICAgdmVjdG9yPGludD4gbHM7CiAgICAgICAgICAgIGZvcihpbnQgdD1pO3Q8ajt0KyspIGxzLnB1c2hfYmFjayhsc3RbdF0uc2Vjb25kKTsKICAgICAgICAgICAgc29ydChhbGwobHMpKTsKICAgICAgICAgICAgaW50IGNudD0wLCBjZT0tMTsKICAgICAgICAgICAgZm9yKGF1dG8gbDogbHMpewogICAgICAgICAgICAgICAgaW50IHMgPSBsOwogICAgICAgICAgICAgICAgaW50IGUgPSBsICsgbGVuIC0yOwogICAgICAgICAgICAgICAgaWYocyA+IGNlICsxKXsKICAgICAgICAgICAgICAgICAgICBjbnQgKz0gKGUgLXMgKzEpOwogICAgICAgICAgICAgICAgICAgIGNlID0gZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGVsc2V7CiAgICAgICAgICAgICAgICAgICAgaWYoZSA+IGNlKXsKICAgICAgICAgICAgICAgICAgICAgICAgY250ICs9IChlIC0gY2UpOwogICAgICAgICAgICAgICAgICAgICAgICBjZSA9IGU7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGludCBrID0gTiAtIGNudDsKICAgICAgICAgICAgaWYoayA+PTEgJiYgayA8PU4pewogICAgICAgICAgICAgICAgYW5zW2tdID0gbWluKGFuc1trXSwgbGVuKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBpID1qOwogICAgICAgIH0KICAgIH0KICAgIGZvcihpbnQgaz0xOyBrPD1OOyBrKyspIHByaW50ZigiJWQgIiwgKGFuc1trXSA8PU4pPyBhbnNba10gOjApOwogICAgcHV0cygiIik7Cn0KCmludCBtYWluKHZvaWQpIHsKI2lmbmRlZiBPTkxJTkVfSlVER0UKICAgIGZyZW9wZW4oImlucHV0LnR4dCIsICJyIiwgc3RkaW4pOwojZW5kaWYKICAgIGludCB0ID0xOwogICAgd2hpbGUodC0tKQogICAgICAgIHNvbHZlKCk7CiAgICByZXR1cm4gMDsKfQo=