#include<stdio.h> #include<string.h> int main() { char b[1000001]; int a[1000001],i,t=0,n,k; scanf("%s",b); n=strlen(b); for(i=0;i<n;i++) { if(b[i]=='l'){a[t]=i+1;t++;} else printf("%d\n",i+1); } t--; for(;t>=0;t--)printf("%d\n",a[t]); return 0; }
http://codeforces.com/contest/265/problem/C