#include <bits/stdc++.h>
#define ull unsigned long long
using namespace std;
const ull base = 129ull;
char str[2000000];
ull hash[2000000];
int cur[2000000];
ull _pow[2000000];
int n;
inline ull Hash(int l, int r) {
if (l) return hash[r]-hash[l-1]*_pow[r-l+1];
return hash[r];
}
inline bool cmp(int a, int b){
int l = 1;
int r = n-max(a, b)+1;
int mid;
while (l < r) {
mid = (l*5+r*3)>>3;
if (Hash(a, a+mid-1)==Hash(b, b+mid-1)) {
l = mid+1;
continue;
}
r = mid;
}
return str[a+r-1] < str[b+r-1];
}
int main() {
string solo;
scanf("%s", str);
n = strlen(str);
hash[0] = str[0];
_pow[0] = 1;
for (register int i = 1; i <= n; i++) {
hash[i] = hash[i-1]*base+str[i];
cur[i] = i;
_pow[i] = _pow[i-1]*base;
}
sort(cur, cur+n, cmp);
for (register int i = 0; i < n; i++) {
printf("%d ", cur[i]+1);
}
return 0;
}