#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef __int128 lint;
typedef double db;
typedef void vd;
typedef bool bl;
inline ll read() {
ll s = 0, w = 1;
char ch = getchar();
while (ch < '0' || ch > '9') {
if (ch == '-')
w = -1;
ch = getchar();
}
while (ch >= '0' && ch <= '9') s = s * 10 + ch - '0', ch = getchar();
return s * w;
}
inline vd print(ll x) {
if (x < 0) {
putchar('-');
x = -x;
}
if (x >= 10)
print(x / 10);
putchar(x % 10 + '0');
return;
}
ll n;
string s;
struct node{
string op;
ll id;
}a[1000005];
bool cmp(node a,node b){
return a.op<b.op;
}
int main() {
cin>>s;
ll len=s.size();
a[len-1].op=s[len-1];
for(int i=len-1;i>=0;i--){
a[i].op=s[i]+a[i+1].op;
a[i].id=i;
}
sort(a,a+len,cmp);
for(int i=0;i<len;i++) printf("%lld ",a[i].id+1);
return 0;
}
后面全MLE