#include <algorithm> #include <iostream> #include <cstring> #include <cstdio> #include <vector> #include <queue> using namespace std; const int maxn = 2e6 + 10; struct node { char s[maxn]; int Lyndon_end[maxn]; int coun; void get_Lyndon() { coun = 0; int N = strlen(s), j, k; for (int i = 0; i < N;) { j = i; k = i + 1; while (k <= N && s[j] <= s[k]) { if (s[j] < s[k]) j = i; else j++; k++; } while (i <= j) { Lyndon_end[coun++] = i + k - j - 1; i += k - j; } } } }; int main() { node Ly; scanf("%s", Ly.s); Ly.get_Lyndon(); for (int i = 0; i < Ly.coun; i++) cout << Ly.Lyndon_end[i] + 1 << " "; return 0; }