#include <iostream>
#include <vector>
#include <string>
#include <set>
using namespace std;
class UnionFind {
private:
vector<int> parent, rank;
int components;
public:
UnionFind(int n) : parent(n), rank(n, 0), components(n) {
for (int i = 0; i < n; i++) parent[i] = i;
}
int find(int x) {
if (parent[x] != x) {
parent[x] = find(parent[x]);
}
return parent[x];
}
bool unite(int x, int y) {
int px = find(x), py = find(y);
if (px == py) return false;
components--;
if (rank[px] < rank[py]) {
parent[px] = py;
} else if (rank[px] > rank[py]) {
parent[py] = px;
} else {
parent[py] = px;
rank[px]++;
}
return true;
}
int getComponents() {
return components;
}
};
vector<int> solve(const string& s) {
int n = s.length();
vector<int> result(n, 0);
// Pour chaque longueur possible de substring
for (int len = 1; len <= n; len++) {
// Pour chaque position de début possible
set<string> patterns;
for (int i = 0; i + len <= n; i++) {
patterns.insert(s.substr(i, len));
}
// Pour chaque pattern possible
for (const string& pattern : patterns) {
UnionFind uf(n);
// Chercher toutes les occurrences du pattern
for (int i = 0; i + len <= n; i++) {
if (s.substr(i, len) == pattern) {
// Connecter les îles consécutives dans cette occurrence
for (int j = i; j < i + len - 1; j++) {
uf.unite(j, j + 1);
}
}
}
int components = uf.getComponents();
if (result[components - 1] == 0 || len < result[components - 1]) {
result[components - 1] = len;
}
}
}
return result;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
string s;
cin >> s;
vector<int> result = solve(s);
for (int i = 0; i < result.size(); i++) {
if (i > 0) cout << " ";
cout << result[i];
}
cout << "\n";
return 0;
}