#include <cstdio>
#include <iostream>
#include <vector>
#include <cmath>
#include <string>

using namespace std;

int main()
{
    freopen("army.in", "r", stdin);
    freopen("army.out", "w", stdout);
    string s;
    getline(cin, s);
    vector<int> z(s.length());
    z[0] = s.length();
    int l = 0, r = 0;
    for (int i = 1; i < s.length(); ++i)
    {
        z[i] = max(0, min(z[i - l], r - i + 1));
        while (i + z[i] < s.length() && s[z[i]] == s[i  + z[i]]) z[i]++;
        if (i + z[i] -  1 > r)
        {
            l = i;
            r = i + z[i] - 1;
        }
    } 
    
    for (int i = 0; i < z.size(); i++)
        z[i] = (z[i] -  1) / 2;
    
    vector<int> y(z.size());
    int cur = 0;
    for (int i = 0; i < z.size(); i++)
    {
        while (cur < z.size() && cur + z[cur] < i) cur++;
        y[i] = i - cur;
    }
    for (int i = 0; i < z.size(); i++)
        cout << ((s[i - y[i]] == s[0]) ? (2 * y[i] + 1) : 0) << (i + 1 == z.size() ? "\n" : " ");
}
