#include <cstdio>
#include <cstring>
#define N 111111
int cc[N],sa[N],h[N],rank[N],wa[N],ws[N],wb[N],wv[N],n;
char c[N];
bool cmp(int *r, int a, int b, int l){
	return r[a] == r[b] && r[a + l] == r[b + l];
}
void da(int *r, int *sa, int n, int m){//*r:蜴滉クイ *sa:蜷守シ?焚扈?シ茎a[0]荳コ遨コ荳イ(sa[0] = n - 1) n:諤サ髟ソ m:蟄礼ャヲ闌?峩
	int i, j, p, *x = wa, *y = wb, *t;
	memset(ws, 0, sizeof ws);
	for (i = 0; i < n; i ++ ) ws[x[i] = r[i]] ++ ;
	for (i = 1; i < m; i ++ ) ws[i] += ws[i - 1];
	for (i = n - 1; i >= 0; i -- ) sa[ -- ws[x[i]]] = i;
	for (j = 1, p = 1; p < n; j *= 2, m = p){
		for (p = 0, i = n - j; i < n; i ++ ) y[p ++ ] = i;
		for (i = 0; i < n; i ++ ) if (sa[i] >= j) y[p ++ ] = sa[i] - j;
		for (i = 0; i < n; i ++ ) wv[i] = x[y[i]];
		memset(ws, 0, sizeof ws);
		for (i = 0; i < n; i ++ ) ws[wv[i]] ++ ;
		for (i = 1; i < m; i ++ ) ws[i] += ws[i - 1];
		for (i = n - 1; i >= 0; i -- ) sa[ -- ws[wv[i]]] = y[i];
		for (t = x, x = y, y = t, p = 1, i = 1, x[sa[0]] = 0; i < n; i ++ )
			x[sa[i]] = cmp(y, sa[i], sa[i - 1], j) ? p - 1 : p ++ ;
	}
	return;
}
void gua(int *r, int *sa, int n){//rank:謗貞錐 h:height謨ー扈?	int i, j, k = 0;
	for (i = 1; i <= n; i ++ ) rank[sa[i]] = i;
	for (i = 0; i < n; h[rank[i ++ ]] = k)
		for (k ? k -- : 0, j = sa[rank[i] - 1]; r[i + k] == r[j + k]; k ++ );
	return;
}
int main(){
	scanf("%s", c);
	n = strlen(c);
	c[n ++ ] = 0;//譛ォ蟆セ髴?刈荳頑欠遉コ隨ヲ/000;
	for (int i = 0; i < n; i ++ ) cc[i] = c[i];
	da(cc, sa, n, 127);
	gua(cc, sa, -- n);//n髴?△螟榊次髟ソ?敬[i]荳コsa[i]蜥茎a[i - 1]蜈ャ蜈ア髟ソ蠎ヲ?茎a[0]荳コ譛ォ蟆セ遨コ荳イ
	for (int i = 0; i <= n; i ++ ) printf("%d ",sa[i]);
}