#include <cstdio>
#include <cstring>
const int N = 400050;
char str[N];
int next[N], ans[N];
int main()
{
    while (~scanf("%s", str))
    {
        int len = strlen(str);
        next[0] = -1;
        for (int i = 0, j = -1; i < len; next[++i] = ++j)
            while (~j && str[i] != str[j]) j = next[j];
        int idx = 0;
        for (int i = len; i; i = next[i])
            ans[idx++] = next[i];
        idx--;
        while (idx)
            printf("%d ", ans[--idx]);
        printf("%d\n", len);
    }
    return 0;
}