Squirrel Liss lived in a forest peacefully, but unexpected trouble happens. Stones fall from a mountain. Initially Squirrel Liss occupies an interval [0, 1]. Next, n stones will fall and Liss will escape from the stones. The stones are numbered from 1 to n in order.

The stones always fall to the center of Liss's interval. When Liss occupies the interval [k - d, k + d] and a stone falls to k, she will escape to the left or to the right. If she escapes to the left, her new interval will be [k - d, k]. If she escapes to the right, her new interval will be [k, k + d].

You are given a string s of length n. If the i-th character of s is "l" or "r", when the i-th stone falls Liss will escape to the left or to the right, respectively. Find the sequence of stones' numbers from left to right after all the n stones falls.


-----Input-----

The input consists of only one line. The only line contains the string s (1 ≤ |s| ≤ 10^6). Each character in s will be either "l" or "r".


-----Output-----

Output n lines — on the i-th line you should print the i-th stone's number from the left.


-----Examples-----
Input
llrlr

Output
3
5
4
2
1

Input
rrlll

Output
1
2
5
4
3

Input
lrlrr

Output
2
4
5
3
1



-----Note-----

In the first example, the positions of stones 1, 2, 3, 4, 5 will be $\frac{1}{2}, \frac{1}{4}, \frac{1}{8}, \frac{3}{16}, \frac{5}{32}$, respectively. So you should print the sequence: 3, 5, 4, 2, 1.

Source: codeforces | Difficulty: EASY
Tags: Amortized analysis

Data structures

Implementation

Constructive algorithms


Solutions:
s = input()
a = []
n = len(s)
for i in range(n):
	if s[i] == 'r':
		print(i + 1)
	else:
		a.append(i + 1)
a.reverse()
for i in a:
	print(i)


class TreeNode(object):

	def __init__(self, x):
		self.val = x
		self.left = None
		self.right = None

class Solution(object):

	def inorderTraversal(self, root):
		stack = []
		res = []
		if not root:
			return []
		while root or stack:
			while root:
				stack.append(root)
				root = root.left
			if stack:
				a = stack.pop()
				root = a.right
				res.append(a.val)
		return res
sol = Solution()
tree = []
tree.append(TreeNode(1))
root = tree[0]
str = input()
for i in range(len(str) - 1):
	tree.append(TreeNode(i + 2))
	if str[i] == 'l':
		tree[i].left = tree[i + 1]
	else:
		tree[i].right = tree[i + 1]
res = sol.inorderTraversal(root)
for x in res:
	print(x)


s = input()
(l, r) = ([], [])
n = len(s)
for i in range(n):
	if s[i] == 'l':
		l.append(i + 1)
	else:
		r.append(i + 1)
l = sorted(l, reverse=True)
r.extend(l)
for i in r:
	print(i)


s = input()
rights = []
lefts = []
for (i, x) in enumerate(s, 1):
	if x == 'l':
		lefts.append(i)
	else:
		print(i)
for x in reversed(lefts):
	print(x)


import sys
import math as mt
import bisect
t = 1
for __ in range(t):
	s = input()
	a = []
	b = []
	for i in range(len(s)):
		if s[i] == 'l':
			a.append(i + 1)
		else:
			b.append(i + 1)
	for i in range(len(b)):
		print(b[i])
	for i in range(len(a) - 1, -1, -1):
		print(a[i])


s = input()
(l, r) = ([], [])
for x in range(len(s)):
	if s[x] == 'r':
		r.append(x + 1)
	else:
		l.append(x + 1)
for el in r:
	print(el)
for el in l[::-1]:
	print(el)


actions = input().strip()
for i in range(len(actions)):
	if actions[i] == 'r':
		print(i + 1)
for i in range(len(actions) - 1, -1, -1):
	if actions[i] == 'l':
		print(i + 1)


s = input()
l = []
r = []
for (i, c) in enumerate(s):
	if c == 'l':
		l.append(i + 1)
	if c == 'r':
		r.append(i + 1)
for i in r:
	print(i)
for i in l[::-1]:
	print(i)


import sys

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
string = input()
right = []
left = []
length = len(string)
for i in range(length):
	if string[i] == 'r':
		right.append(i + 1)
	else:
		left.append(i + 1)
left.reverse()
for i in right:
	print(i)
for i in left:
	print(i)


import sys

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
string = input()
right = []
left = []
for (i, j) in enumerate(string):
	if j == 'r':
		right.append(i + 1)
	else:
		left.append(i + 1)
left.reverse()
for i in right:
	print(i)
for i in left:
	print(i)


s = input()
l = []
r = []
for i in range(len(s)):
	if s[i] == 'l':
		l.append(i + 1)
	else:
		r.append(i + 1)
r.extend(l[::-1])
for i in r:
	print(i)


s = input()
r = []
l = []
num = 1
for i in s:
	if i == 'r':
		r.append(num)
	elif i == 'l':
		l.append(num)
	num += 1
res = r + l[::-1]
for i in res:
	print(i)


s = input()
l = []
r = []
ind = 1
for ch in s:
	if ch == 'l':
		l.append(ind)
	else:
		r.append(ind)
	ind += 1
for n in r:
	print(n)
for i in range(len(l) - 1, -1, -1):
	print(l[i])


from sys import stdin, stdout
s = input().strip()
n = len(s)
left = 0
right = n - 1
vs = [0] * n
for i in range(n):
	if s[i] == 'l':
		vs[right] = str(i + 1)
		right -= 1
	else:
		vs[left] = str(i + 1)
		left += 1
print('\n'.join(vs))


mod = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
it = lambda : tuple(map(int, input().split()))
ls = lambda : list(input())
s = si()
(lt, rt) = ([], [])
for i in range(len(s)):
	if s[i] == 'l':
		lt.append(i + 1)
	else:
		rt.append(i + 1)
for i in rt:
	print(i)
for i in lt[::-1]:
	print(i)


s = input()
d = [c for c in s]
for i in range(len(d)):
	if d[i] == 'r':
		print(i + 1)
for i in range(len(d) - 1, -1, -1):
	if d[i] == 'l':
		print(i + 1)


s = input()
ans = [0] * len(s)
l = 0
r = len(s) - 1
for (i, c) in enumerate(s, start=1):
	if c == 'l':
		ans[r] = i
		r -= 1
	else:
		ans[l] = i
		l += 1
for c in ans:
	print(c)


s = input()
for i in range(len(s)):
	if s[i] == 'r':
		print(i + 1)
i = len(s) - 1
while i >= 0:
	if s[i] == 'l':
		print(i + 1)
	i -= 1


MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
s = input()
n = len(s)
ans = [0] * (n + 1)
l = n
r = 1
stone = 1
for i in s:
	if i == 'l':
		ans[l] = stone
		l -= 1
	if i == 'r':
		ans[r] = stone
		r += 1
	stone += 1
for i in ans[1:]:
	print(i)


s = input()
n = len(s)
prevl = 0
prevr = 1
pos = []
left = []
right = []
pos.append([0, 1 / 2])
curr = 1 / 2
for i in range(0, n):
	if s[i] == 'l':
		left.append(i + 1)
	else:
		right.append(i + 1)
ans = right + left[::-1]
print(*ans)


s = input()
A = [0] * len(s)
s1 = 'l'
k = 0
v = 0
for i in range(len(s)):
	if s[i] == s1:
		A[len(s) - i - 1 + v] = i + 1
	else:
		A[k] = i + 1
		k += 1
		v += 1
for i in range(len(A)):
	print(A[i])


def main():
	l = [-1, 0, 6, 0, 6, 0, 1, 0, 3]
	liss = 6
	for (i, c) in enumerate(input()[:-1], 2):
		l.append(i)
		if c == 'l':
			l.append(l[-3])
			l.append(liss)
			liss += 3
			l[l[-5] + 2] = l[-5] = liss
		else:
			l.append(liss)
			l.append(l[-3])
			liss += 3
			l[l[-4] + 1] = l[-4] = liss
	(liss, res) = (l[2], [])
	while l[liss]:
		res.append(l[liss])
		liss = l[liss + 2]
	print(' '.join(map(str, res)))
main()


import sys

def get_ints():
	return list(map(int, sys.stdin.readline().strip().split()))
strs = input()
leftarr = []
rightarr = []
for (i, j) in enumerate(strs):
	if j == 'l':
		leftarr.append(i + 1)
	else:
		rightarr.append(i + 1)
for i in rightarr:
	print(i)
leftarr = leftarr[::-1]
for i in leftarr:
	print(i)


(z, zz) = (input, lambda : list(map(int, z().split())))
fast = lambda : stdin.readline().strip()
zzz = lambda : [int(i) for i in fast().split()]
(szz, graph, mod, szzz) = (lambda : sorted(zz()), {}, 10 ** 9 + 7, lambda : sorted(zzz()))
from string import *
from re import *
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f
from bisect import bisect as bs
from bisect import bisect_left as bsl
from itertools import accumulate as ac

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def prime(x):
	p = ceil(x ** 0.5) + 1
	for i in range(2, p):
		if x % i == 0 and x != 2 or x == 0:
			return 0
	return 1

def dfs(u, visit, graph):
	visit[u] = 1
	for i in graph[u]:
		if not visit[i]:
			dfs(i, visit, graph)
arr = fast()
for (i, j) in enumerate(arr):
	if j == 'r':
		print(i + 1)
for (i, j) in enumerate(arr[::-1]):
	if j == 'l':
		print(len(arr) - i)


s = input()
l = []
r = []
for (i, j) in enumerate(s):
	if j == 'l':
		l.append(i)
	else:
		r.append(i)
for i in r:
	print(i + 1)
for i in reversed(l):
	print(i + 1)


t = input()
(a, b) = ([i for (i, d) in enumerate(t, 1) if d == 'l'], [i for (i, d) in enumerate(t, 1) if d == 'r'])
a.reverse()
print('\n'.join(map(str, b)))
print('\n'.join(map(str, a)))


s = input()
ans = [0 for i in range(len(s))]
m = len(s)
n = 0
for i in range(len(s)):
	if s[i] == 'l':
		ans[i] = m
		m -= 1
	else:
		n += 1
		ans[i] = n
gam = [0 for i in range(len(s))]
for i in range(len(ans)):
	gam[ans[i] - 1] = i + 1
for i in range(len(gam)):
	print(gam[i])


import sys
from math import log2, floor, ceil, sqrt, gcd
import bisect
sys.setrecursionlimit(10 ** 5)
Ri = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 1000000007
st = ri()
a = []
b = []
for i in range(len(st)):
	if st[i] == 'l':
		a.append(i + 1)
	else:
		b.append(i + 1)
for i in b:
	print(i)
for i in a[::-1]:
	print(i)


s = input()
n = len(s)
a = 1
ans = [0] * n
for i in range(n):
	if s[i] == 'l':
		ans[n - 1] = i + 1
		n -= 1
	else:
		ans[a - 1] = i + 1
		a += 1
for i in ans:
	print(i)


s = input()
s = list(s)
(a, b) = ([], [])
for i in range(len(s)):
	if s[i] == 'l':
		b.append(i + 1)
	else:
		a.append(i + 1)
b.sort(reverse=True)
a = a + b
for i in a:
	print(i)


st = input()
a = []
b = []
for i in range(len(st)):
	if st[i] == 'r':
		a.append(i + 1)
	else:
		b.append(i + 1)
c = a + b[::-1]
for i in c:
	print(i)


s = input()
n = len(s)
ans = [0] * n
start = 0
end = n - 1
for i in range(n):
	if s[i] == 'l':
		ans[end] = i + 1
		end -= 1
	else:
		ans[start] = i + 1
		start += 1
print('\n'.join([str(item) for item in ans]))


from __future__ import division, print_function
import math
import os
import sys
from fractions import *
from sys import *
from decimal import *
from io import BytesIO, IOBase
from itertools import *
from collections import *
M = 10 ** 9 + 7
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def fsep():
	return map(float, inp().split())

def inpu():
	return int(inp())

def regularbracket(t):
	p = 0
	for i in t:
		if i == '(':
			p += 1
		else:
			p -= 1
		if p < 0:
			return False
	else:
		if p > 0:
			return False
		else:
			return True

def binarySearchCount(arr, n, key):
	left = 0
	right = n - 1
	count = 0
	while left <= right:
		mid = int((right + left) / 2)
		if arr[mid] <= key:
			count = mid + 1
			left = mid + 1
		else:
			right = mid - 1
	return count

def reverse1(string):
	pp = ''
	for i in string[::-1]:
		pp += i
	if pp == string:
		return True
	return False

def reverse2(list1):
	l = []
	for i in list1[::-1]:
		l.append(i)
	if l == list1:
		return True
	return False

def mex(list1):
	p = max(list1) + 1
	for i in range(len(list1)):
		if list1[i] != i:
			p = i
			break
	return p

def sumofdigits(n):
	n = str(n)
	s1 = 0
	for i in n:
		s1 += int(i)
	return s1

def perfect_square(n):
	s = math.sqrt(n)
	if s == int(s):
		return True
	return False

def roman_number(x):
	if x > 15999:
		return
	value = [5000, 4000, 1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1]
	symbol = ['F', 'MF', 'M', 'CM', 'D', 'CD', 'C', 'XC', 'L', 'XL', 'X', 'IX', 'V', 'IV', 'I']
	roman = ''
	i = 0
	while x > 0:
		div = x // value[i]
		x = x % value[i]
		while div:
			roman += symbol[i]
			div -= 1
		i += 1
	return roman

def soretd(s):
	for i in range(1, len(s)):
		if s[i - 1] > s[i]:
			return False
	return True

def countRhombi(h, w):
	ct = 0
	for i in range(2, h + 1, 2):
		for j in range(2, w + 1, 2):
			ct += (h - i + 1) * (w - j + 1)
	return ct

def countrhombi2(h, w):
	return h * h // 4 * (w * w // 4)

def binpow(a, b):
	if b == 0:
		return 1
	else:
		res = binpow(a, b // 2)
	if b % 2 != 0:
		return res * res * a
	else:
		return res * res

def binpowmodulus(a, b, m):
	a %= m
	res = 1
	while b > 0:
		if b & 1:
			res = res * a % m
		a = a * a % m
		b >>= 1
	return res

def coprime_to_n(n):
	result = n
	i = 2
	while i * i <= n:
		if n % i == 0:
			while n % i == 0:
				n //= i
			result -= result // i
		i += 1
	if n > 1:
		result -= result // n
	return result

def prime(x):
	if x == 1:
		return False
	else:
		for i in range(2, int(math.sqrt(x)) + 1):
			if x % i == 0:
				return False
		else:
			return True

def luckynumwithequalnumberoffourandseven(x, n, a):
	if x >= n and str(x).count('4') == str(x).count('7'):
		a.append(x)
	elif x < 1000000000000.0:
		luckynumwithequalnumberoffourandseven(x * 10 + 4, n, a)
		luckynumwithequalnumberoffourandseven(x * 10 + 7, n, a)
	return a

def luckynuber(x, n, a):
	p = set(str(x))
	if len(p) <= 2:
		a.append(x)
	if x < n:
		luckynuber(x + 1, n, a)
	return a

def interact(type, x):
	if type == 'r':
		inp = input()
		return inp.strip()
	else:
		print(x, flush=True)

def findTrailingZeros(n):
	count = 0
	while n >= 5:
		n //= 5
		count += n
	return count

def mergeSort(arr):
	if len(arr) > 1:
		mid = len(arr) // 2
		L = arr[:mid]
		R = arr[mid:]
		mergeSort(L)
		mergeSort(R)
		i = j = k = 0
		while i < len(L) and j < len(R):
			if L[i] < R[j]:
				arr[k] = L[i]
				i += 1
			else:
				arr[k] = R[j]
				j += 1
			k += 1
		while i < len(L):
			arr[k] = L[i]
			i += 1
			k += 1
		while j < len(R):
			arr[k] = R[j]
			j += 1
			k += 1
res = set()

def solven(p, l, a, b, n):
	if p > n or l > 10:
		return
	if p > 0:
		res.add(p)
	solven(p * 10 + a, l + 1, a, b, n)
	solven(p * 10 + b, l + 1, a, b, n)

def subsetsUtil(A, subset, index, d):
	print(*subset)
	s = sum(subset)
	d.append(s)
	for i in range(index, len(A)):
		subset.append(A[i])
		subsetsUtil(A, subset, i + 1, d)
		subset.pop(-1)
	return d

def subsetSums(arr, l, r, d, sum=0):
	if l > r:
		d.append(sum)
		return
	subsetSums(arr, l + 1, r, d, sum + arr[l])
	subsetSums(arr, l + 1, r, d, sum)
	return d

def print_factors(x):
	factors = []
	for i in range(1, x + 1):
		if x % i == 0:
			factors.append(i)
	return factors

def calc(X, d, ans, D):
	if len(X) == 0:
		return
	i = X.index(max(X))
	ans[D[max(X)]] = d
	Y = X[:i]
	Z = X[i + 1:]
	calc(Y, d + 1, ans, D)
	calc(Z, d + 1, ans, D)

def factorization(n, l):
	c = n
	if prime(n) == True:
		l.append(n)
		return l
	for i in range(2, c):
		if n == 1:
			break
		while n % i == 0:
			l.append(i)
			n = n // i
	return l

def good(b):
	l = []
	i = 0
	while len(b) != 0:
		if b[i] < b[len(b) - 1 - i]:
			l.append(b[i])
			b.remove(b[i])
		else:
			l.append(b[len(b) - 1 - i])
			b.remove(b[len(b) - 1 - i])
	if l == sorted(l):
		return True
	return False

def generate(st, s):
	if len(s) == 0:
		return
	if s not in st:
		st.add(s)
		for i in range(len(s)):
			t = list(s).copy()
			t.remove(s[i])
			t = ''.join(t)
			generate(st, t)
	return

def largestincreasingsubsequence(A):
	l = [1] * len(A)
	sub = []
	for i in range(1, len(l)):
		for k in range(i):
			if A[k] < A[i]:
				sub.append(l[k])
		l[i] = 1 + max(sub, default=0)
	return max(l, default=0)

def main():
	s = input()
	for i in range(len(s)):
		if s[i] == 'r':
			print(i + 1)
	for i in range(len(s) - 1, -1, -1):
		if s[i] == 'l':
			print(i + 1)
main()


import sys
import collections
line = sys.stdin.readline()
leftList = collections.deque()
rightList = collections.deque()
for i in range(len(line)):
	if line[i] == 'l':
		leftList.appendleft(i + 1)
	elif line[i] == 'r':
		rightList.append(i + 1)
for c in rightList:
	print(c)
for c in leftList:
	print(c)


class LN:
	data = None
	left = None
	right = None

	def __init__(self, data, left, right):
		self.data = data
		self.left = left
		self.right = right
inst = input()
root = LN(1, None, None)
ptr = root
i = 2
for j in range(len(inst) - 1):
	if inst[j] == 'l':
		ptr.left = LN(i, ptr.left, ptr)
		if ptr.left.left:
			ptr.left.left.right = ptr.left
		ptr = ptr.left
		if root.left:
			root = root.left
	else:
		ptr.right = LN(i, ptr, ptr.right)
		if ptr.right.right:
			ptr.right.right.left = ptr.right
		ptr = ptr.right
	i += 1
trav = root
print(root.data)
while trav.right:
	trav = trav.right
	print(trav.data)


s = input()
pos1 = []
pos2 = []
n = len(s)
for i in range(n):
	if s[i] == 'l':
		pos2.append(i + 1)
	else:
		pos1.append(i + 1)
for i in pos1:
	print(i)
for i in pos2[::-1]:
	print(i)


s = str(input())
left = []
right = []
for t in range(len(s)):
	if s[t] == 'r':
		left.append(t + 1)
	else:
		right.append(t + 1)
for i in range(len(left)):
	print(left[i])
for i in range(len(right)):
	print(right[-1 - i])


s = input()
ans = [0] * len(s)
left = 0
right = len(s) - 1
for i in range(len(s)):
	if s[i] == 'r':
		ans[left] = i + 1
		left += 1
	else:
		ans[right] = i + 1
		right -= 1
print(*list(ans))


s = input()
cnt = 0
a = []
for (i, c) in enumerate(s):
	if c == 'l':
		a.append((cnt, i + 1))
		cnt += 1
	else:
		a.append((cnt + len(s) - i - 1, i + 1))
a.sort(reverse=True)
print(*[i for (c, i) in a], sep='\n')


def escape(s):
	for i in range(len(s)):
		if s[i] == 'r':
			print(i + 1)
	for i in range(len(s) - 1, -1, -1):
		if s[i] == 'l':
			print(i + 1)
	return ''
print(escape(input()))


def main():
	left = -1
	right = -1
	edges = {}
	s = input()
	for i in range(len(s)):
		edges[i + 1] = right
		edges[left] = i + 1
		if s[i] == 'l':
			right = i + 1
		else:
			left = i + 1
	curr = edges[-1]
	while curr != -1:
		print(curr)
		curr = edges[curr]
main()


s = input()
n = len(s)
ans = [0] * n
left = n - 1
right = 0
if s[0] == 'l':
	ans[n - 1] = 1
	left -= 1
else:
	ans[0] = 1
	right += 1
for i in range(1, n):
	if s[i] == 'l':
		ans[left] = i + 1
		left -= 1
	else:
		ans[right] = i + 1
		right += 1
for num in ans:
	print(num)


from sys import stdin
import collections
import os
import sys
from io import IOBase, BytesIO
from sys import stdin, stdout
from math import sqrt
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange

def main():
	moves = input()
	missiles = [0] * len(moves)
	z = -1
	k = 0
	c = 1
	for i in moves:
		if i == 'l':
			missiles[z] = c
			c += 1
			z -= 1
		else:
			missiles[k] = c
			c += 1
			k += 1
	for i in missiles:
		print(i)
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')

class ostream:

	def __lshift__(self, a):
		sys.stdout.write(str(a))
		return self
cout = ostream()
endl = '\n'
main()


s = input()
ans = [0 for i in range(len(s))]
lp = 0
rp = len(s) - 1
for i in range(len(s)):
	if s[i] != 'l':
		ans[lp] = i + 1
		lp += 1
	else:
		ans[rp] = i + 1
		rp -= 1
for i in ans:
	print(i)


import os
import sys
from io import BytesIO, IOBase
sys.setrecursionlimit(95000)

def main():
	pass
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()
s = input()
n = len(s)
for i in range(n):
	if s[i] == 'r':
		print(i + 1)
for i in range(n - 1, -1, -1):
	if s[i] == 'l':
		print(i + 1)


s = input()
l = []
v = []
for i in range(len(s)):
	if s[i] == 'l':
		l.append(i + 1)
	else:
		v.append(i + 1)
for i in range(len(v)):
	print(v[i])
for i in range(len(l)):
	print(l[len(l) - i - 1])


s = input()
l = [0] * len(s)
a = 0
b = len(s) - 1
for i in range(len(s)):
	if s[i] == 'l':
		l[b] = str(i + 1)
		b -= 1
	else:
		l[a] = str(i + 1)
		a += 1
print('\n'.join(l))


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def fi():
	return float(input())

def si():
	return input()

def msi():
	return map(str, input().split())

def mi():
	return map(int, input().split())

def li():
	return list(mi())

def read():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def lcm(x, y):
	return x * y // gcd(x, y)
mod = 1000000007

def modInverse(b, m):
	g = gcd(b, m)
	if g != 1:
		return -1
	else:
		return pow(b, m - 2, m)

def ceil(x, y):
	if x % y == 0:
		return x // y
	else:
		return x // y + 1

def modu(a, b, m):
	a = a % m
	inv = modInverse(b, m)
	if inv == -1:
		return -999999999
	else:
		return inv * a % m
from math import log, factorial, cos, tan, sin, radians, floor, log2
import bisect
from decimal import *
getcontext().prec = 50
abc = 'abcdefghijklmnopqrstuvwxyz'
pi = 3.141592653589793

def gcd1(a):
	if len(a) == 1:
		return a[0]
	ans = a[0]
	for i in range(1, len(a)):
		ans = gcd(ans, a[i])
	return ans

def main():
	for _ in range(1):
		s = si()
		l = []
		r = []
		c = 1
		for i in range(len(s)):
			if s[i] == 'l':
				l.append(c)
			else:
				r.append(c)
			c += 1
		ans = []
		l = l[::-1]
		ans.extend(r)
		ans.extend(l)
		for i in ans:
			print(i)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


s = input()
n = len(s)
(left, right) = (0, 1)
(start, end) = (1, n)
pos = [0 for i in range(n + 1)]
for i in range(n):
	if s[i] == 'l':
		pos[end] = i + 1
		end -= 1
	else:
		pos[start] = i + 1
		start += 1
for i in range(1, n + 1):
	print(pos[i])


t = input()
print('\n'.join(map(str, [i for (i, d) in enumerate(t, 1) if d == 'r'])) + '\n' + '\n'.join(map(str, reversed([i for (i, d) in enumerate(t, 1) if d == 'l']))))


s = input()
n = len(s)
left = []
right = []
for i in range(n):
	if s[i] == 'l':
		left.append(i + 1)
	else:
		right.append(i + 1)
for x in right + left[::-1]:
	print(x)


from sys import stdin, stdout
stdin.readline

def mp():
	return list(map(int, stdin.readline().strip().split()))

def it():
	return int(stdin.readline().strip())
from collections import defaultdict as dd, Counter as C, deque
from math import ceil, gcd, sqrt, factorial, log2, floor
import heapq
s = list(input())
n = len(s)
(x, y) = ([], [])
flag = 0
for i in range(n):
	if s[i] == 'r':
		if not flag:
			y.append(i + 1)
		else:
			x.append(i + 1)
	else:
		x.append(i + 1)
for i in y:
	print(i)
x.reverse()
for i in x:
	print(i)


import sys
s = sys.stdin.readline().strip()
l = len(s)
arr = [0] * l
left = 0
right = l - 1
for i in range(l):
	if s[i] == 'l':
		arr[right] = i + 1
		right -= 1
	else:
		arr[left] = i + 1
		left += 1
for i in arr:
	sys.stdout.write(str(i) + '\n')


class linked_list:

	def __init__(self, val):
		self.val = val
		self.right = None
		self.left = None

	def insert_right(self, node):
		node.right = self.right
		node.left = self
		if self.right:
			self.right.left = node
		self.right = node
		return

	def insert_left(self, node):
		node.left = self.left
		node.right = self
		if self.left:
			self.left.right = node
		self.left = node

	def get_start(self):
		node = self
		while node.left:
			node = node.left
		return node
moves = input()
high = 1
low = 0
position = dict()
curr_node = linked_list(1)
for (idx, char) in enumerate(moves[:-1]):
	new_node = linked_list(idx + 2)
	if char == 'l':
		curr_node.insert_left(new_node)
	else:
		curr_node.insert_right(new_node)
	curr_node = new_node
node = curr_node.get_start()
while node:
	print(node.val)
	node = node.right


import math
from collections import *
import sys
from functools import reduce

def get_ints():
	return map(int, input().strip().split())

def get_list():
	return list(get_ints())

def get_string():
	return list(input().strip().split())

def printxsp(*args):
	return print(*args, end='')

def printsp(*args):
	return print(*args, end=' ')
UGLYMOD = int(1000000000.0) + 7
SEXYMOD = 998244353
MAXN = int(100000.0)
s = input()
li1 = []
li2 = []
for (i, v) in enumerate(s):
	if v == 'l':
		li1.append(i + 1)
	elif v == 'r':
		li2.append(i + 1)
print(*li2, sep='\n')
print(*li1[::-1], sep='\n')


s = input()
l = 0
r = len(s) - 1
ans = [0] * len(s)
for i in range(len(s)):
	if s[i] == 'l':
		ans[r] = i + 1
		r -= 1
	else:
		ans[l] = i + 1
		l += 1
for i in ans:
	print(i)


s = input()
l = []
r = []
ab = []
for i in range(len(s)):
	if s[i] == 'l':
		l.append(str(i + 1))
	else:
		r.append(str(i + 1))
print('\n'.join(r + l[::-1]))


from collections import deque
s = input().rstrip()
ret = deque()
for i in range(len(s) - 1, -1, -1):
	if s[i] == 'l':
		ret.append(i + 1)
	else:
		ret.appendleft(i + 1)
print('\n'.join(map(str, ret)))


s = input()
(st, en) = (0, 1)
(right, left) = ([], [])
for x in range(len(s)):
	if s[x] == 'l':
		left.append(x + 1)
	else:
		right.append(x + 1)
for x in right:
	print(x)
left.reverse()
for y in left:
	print(y)


s = input()
res = []
for i in range(len(s)):
	if s[i] == 'r':
		res.append(str(i + 1))
for i in range(len(s) - 1, -1, -1):
	if s[i] == 'l':
		res.append(str(i + 1))
print('\n'.join(res))


inp = input()
length = len(inp)
(min, max, dic1, dic2) = (1, length, [], [])
for i in range(0, length):
	if inp[i] == 'l':
		dic2.append(i + 1)
	else:
		dic1.append(i + 1)
print('\n'.join(map(str, dic1)))
print('\n'.join(map(str, dic2[::-1])))


a = input()
n = len(a)
sr = []
sl = []
for i in range(n):
	if a[i] == 'r':
		sr.append(i + 1)
	else:
		sl.append(i + 1)
print(*sr + sl[::-1])


s = list(input())
n = len(s)
i = 0
j = n - 1
ans = [0] * n
for k in range(n):
	if s[k] == 'l':
		ans[j] = k + 1
		j -= 1
	else:
		ans[i] = k + 1
		i += 1
for i in range(n):
	print(ans[i])


from collections import deque
s = deque(('l' + input())[:-1])
le = []
ri = []
n = 0
while s:
	c = 0
	ref = s[0]
	while s and s[0] == ref:
		c += 1
		s.popleft()
	if ref == 'l':
		for i in range(c - 1):
			ri.append(n + i + 1)
		le.append(n + c)
		n = n + c
	elif ref == 'r':
		for i in range(c - 1):
			le.append(n + i + 1)
		ri.append(n + c)
		n = n + c
le.extend(ri[::-1])
print('\n'.join([str(i) for i in le]))


import os
import sys
from math import *
from collections import *
from bisect import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
ALPHA = 'abcdefghijklmnopqrstuvwxyz'
M = 10 ** 9 + 7
EPS = 1e-06

def Ceil(a, b):
	return a // b + int(a % b > 0)

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
s = input()
n = len(s)
low = 0
high = n - 1
ans = [0] * n
for i in range(n):
	if s[i] == 'r':
		ans[low] = i + 1
		low += 1
	else:
		ans[high] = i + 1
		high -= 1
for i in ans:
	print(i)


def stones(s):
	result = [-1] * len(s)
	start = 0
	end = len(s) - 1
	for x in range(len(s)):
		if s[x] == 'r':
			result[start] = x + 1
			start += 1
		else:
			result[end] = x + 1
			end -= 1
	for y in result:
		print(y)
s = input()
stones(s)


s = input()
l = 0
j = len(s) - 1
final = [0] * len(s)
for i in range(len(s)):
	if s[i] == 'l':
		final[j] = i + 1
		j -= 1
	else:
		final[l] = i + 1
		l += 1
for i in final:
	print(i)


def scape(s):
	first = []
	last = []
	it = 1
	for ch in s:
		if ch == 'l':
			last.append(it)
		else:
			first.append(it)
		it += 1
	for i in range(len(last) - 1, -1, -1):
		first.append(last[i])
	return first
s = input()
ans = []
ans = scape(s)
for i in ans:
	print(i)


a = list(input())
n = len(a)
for i in range(n):
	if a[i] == 'r':
		print(i + 1)
for i in range(n - 1, -1, -1):
	if a[i] == 'l':
		print(i + 1)


directions = input()
r_stones = []
l_stones = []
stone = 1
for i in directions:
	if i == 'r':
		r_stones.append(stone)
	if i == 'l':
		l_stones.append(stone)
	stone += 1
r_stones.sort()
l_stones.sort(reverse=True)
for i in r_stones + l_stones:
	print(i)


s = input()
n = len(s)
rt = []
lft = []
for i in range(n):
	if s[i] == 'l':
		lft.append(i + 1)
	else:
		rt.append(i + 1)
len_r = len(rt)
len_l = len(lft)
j = 0
l = len_l - 1
for i in range(n):
	if i < len_r:
		print(rt[j])
		j += 1
	else:
		print(lft[l])
		l -= 1


s = input()
n = len(s)
l = 0
r = n - 1
i = 1
ans = [0] * n
for c in s:
	if c == 'l':
		ans[r] = i
		r -= 1
	else:
		ans[l] = i
		l += 1
	i += 1
for a in ans:
	print(a)


s = input()
s1 = []
s2 = []
for i in range(len(s)):
	if s[i] == 'r':
		s1.append(i + 1)
	else:
		s2.append(i + 1)
s3 = s1 + s2[::-1]
for i in range(len(s)):
	print(s3[i])


s = input()
result = [''] * len(s)
l = 0
r = len(s) - 1
for i in range(len(s)):
	if s[i] == 'r':
		result[l] = str(i + 1)
		l += 1
	else:
		result[r] = str(i + 1)
		r -= 1
from sys import stdout
stdout.write('\n'.join(result))


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
import copy
import time
starttime = time.time()
mod = int(pow(10, 9) + 7)
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def L():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
try:
	sys.stdin = open('input.txt', 'r')
except:
	pass
s = input()
l = len(s)
arr = [0] * l
left = 0
right = l - 1
for i in range(l):
	if s[i] == 'l':
		arr[right] = i + 1
		right -= 1
	else:
		arr[left] = i + 1
		left += 1
for i in arr:
	print(str(i))
endtime = time.time()


from collections import *
(s, right, left) = (input(), deque(), deque())
for i in range(len(s)):
	if s[i] == 'l':
		left.appendleft(str(i + 1))
	else:
		right.append(str(i + 1))
print('\n'.join(right))
print('\n'.join(left))


from __future__ import division, print_function
import os
import sys
from io import BytesIO, IOBase

def main():

	class Node:

		def __init__(self, id):
			self.id = id
			self.front = None
			self.back = None

	class LinkedList:

		def __init__(self):
			self.leftLimit = Node(-1)
			self.rightLimit = Node(0)
			self.leftLimit.back = self.rightLimit
			self.rightLimit.front = self.leftLimit
			self.outerLeft = self.leftLimit
			self.outerRight = self.rightLimit
	s = input()
	sequence = LinkedList()
	for i in range(len(s)):
		newNode = Node(i + 1)
		newNode.back = sequence.rightLimit
		newNode.front = sequence.leftLimit
		sequence.rightLimit.front = newNode
		sequence.leftLimit.back = newNode
		if s[i] == 'l':
			sequence.rightLimit = newNode
		else:
			sequence.leftLimit = newNode
	current = sequence.outerLeft.back
	for node in range(len(s)):
		print(current.id)
		current = current.back
BUFFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
input = lambda : sys.stdin.readline().rstrip('\r\n')

def print(*args, **kwargs):
	sep = kwargs.pop('sep', ' ')
	file = kwargs.pop('file', sys.stdout)
	atStart = True
	for x in args:
		if not atStart:
			file.write(sep)
		file.write(str(x))
		atStart = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
main()


s = input()
n = len(s)
output = [0] * n
rposition = 0
lposition = n - 1
for i in range(n):
	if s[i] == 'l':
		output[lposition] = i + 1
		lposition = lposition - 1
	else:
		output[rposition] = i + 1
		rposition = rposition + 1
print('\n'.join([str(item) for item in output]))


import sys
input = sys.stdin.readline
for _ in range(1):
	s = input()
	s = s[:-1]
	(a, b) = ([], [])
	for i in range(len(s)):
		if s[i] == 'r':
			b.append(i)
		else:
			a.append(i)
	a = a[::-1]
	for i in b:
		print(i + 1)
	for i in a:
		print(i + 1)


directions = input()
distances = []
index = 1
ptrs = {'l': [], 'r': []}
for direction in directions:
	ptrs[direction].append(index)
	index += 1
for item in ptrs['r']:
	print(item)
for item in reversed(ptrs['l']):
	print(item)


from sys import stdin, stdout
import fractions
nmbr = lambda : int(stdin.readline())
lst = lambda : list(map(int, stdin.readline().split()))
for _ in range(1):
	(l, r) = (0, 1)
	s = input()
	n = len(s)
	for i in range(n):
		if s[i] == 'r':
			print(i + 1)
	for i in range(n - 1, -1, -1):
		if s[i] == 'l':
			print(i + 1)


s = input()
a = []
b = []
for i in range(0, len(s)):
	if s[i] == 'l':
		a.append(i + 1)
	else:
		b.append(i + 1)
a = a[::-1]
for num in b:
	print(num)
for num in a:
	print(num)


__autor__ = 'Alex239'
s = input().rstrip()
print('\n'.join([str(i + 1) for i in range(len(s)) if s[i] == 'r']), '\n'.join([str(i + 1) for i in range(len(s) - 1, -1, -1) if s[i] == 'l']), sep='\n')


x = input()
A = []
B = []
val = 1
for i in x:
	if i == 'l':
		A.append(val)
	else:
		B.append(val)
	val += 1
for i in B + A[::-1]:
	print(i)


s = str(input())
n = len(s)
(l1, l2) = (list(), list())
for i in range(n):
	if s[i] == 'l':
		l1.append(i + 1)
	else:
		l2.append(i + 1)
for x in l2:
	print(x)
for i in range(len(l1) - 1, -1, -1):
	print(l1[i])


import sys, itertools, math, collections, random

def ia():
	return [int(i) for i in sys.stdin.readline().strip().split(' ')]

def ii():
	return int(sys.stdin.readline().strip())

def istr():
	return sys.stdin.readline().strip()
s = istr()
L = []
R = []
for (i, c) in enumerate(s):
	if c == 'r':
		R.append(i + 1)
	else:
		L.append(i + 1)
for i in R:
	print(i)
for i in reversed(L):
	print(i)


class LinkNode:

	def __init__(self, v):
		self.val = v
		self.prev = None
		self.next = None
s = input()
head = LinkNode(1)
ptr = head
nodes = []
nodes.append(head)
for i in range(len(s) - 1):
	nodes.append(LinkNode(i + 2))
	if s[i] == 'l':
		if ptr.prev:
			ptr.prev.next = nodes[-1]
		nodes[-1].prev = ptr.prev
		nodes[-1].next = ptr
		ptr.prev = nodes[-1]
		ptr = ptr.prev
	else:
		if ptr.next:
			ptr.next.prev = nodes[-1]
		nodes[-1].next = ptr.next
		nodes[-1].prev = ptr
		ptr.next = nodes[-1]
		ptr = ptr.next
ptr = head
while ptr.prev:
	ptr = ptr.prev
while ptr:
	print(ptr.val)
	ptr = ptr.next


(l, r) = ([], [])
for (i, c) in enumerate(input()):
	if c == 'l':
		r += [str(i + 1)]
	else:
		l += [str(i + 1)]
r.reverse()
print('\n'.join(l + r))


s = input()
n = len(s)
a = []
b = []
for i in range(n):
	if s[i] == 'l':
		a.append(i + 1)
	else:
		b.append(i + 1)
a.reverse()
for e in b:
	print(e)
for e in a:
	print(e)


s = input()
(a, b) = ([], [])
for (i, j) in zip(s, range(1, len(s) + 1)):
	if i == 'r':
		a.append(str(j))
	else:
		b.append(str(j))
print('\n'.join(a + b[::-1]))


def sp():
	return map(int, input().split())

def sli():
	return list(sp())
t = 1
for _ in range(t):
	s = input()
	n = len(s)
	sl = []
	sr = []
	for i in range(n):
		if s[i] == 'l':
			sl.append(i + 1)
		else:
			sr.append(i + 1)
	print(*sr + sl[::-1])


s = input()
(l, r) = ([], [])
for i in range(len(s)):
	if s[i] == 'r':
		r.append(i + 1)
	else:
		l.append(i + 1)
l.sort(reverse=1)
print(*r + l, sep='\n')


import sys
s = input()
a = []
b = []
for i in range(len(s)):
	if s[i] == 'l':
		a.append(i + 1)
	else:
		b.append(i + 1)
c = b + a[::-1]
for i in c:
	print(i)


class Node:

	def __init__(self, val):
		self.val = val
		self.next = None
		self.prev = None

def insert(dir, list_head, ptr):
	curr_ptr = Node(ptr.val + 1)
	if dir == 'l':
		if ptr.prev == None:
			curr_ptr.next = ptr
			ptr.prev = curr_ptr
			return (curr_ptr, curr_ptr)
		else:
			ptr.prev.next = curr_ptr
			curr_ptr.prev = ptr.prev
			curr_ptr.next = ptr
			ptr.prev = curr_ptr
			return (list_head, curr_ptr)
	elif ptr.next == None:
		ptr.next = curr_ptr
		curr_ptr.prev = ptr
		return (list_head, curr_ptr)
	else:
		curr_ptr.next = ptr.next
		ptr.next.prev = curr_ptr
		ptr.next = curr_ptr
		curr_ptr.prev = ptr
		return (list_head, curr_ptr)
s = input().strip()
list_head = Node(1)
curr_ptr = list_head
for i in range(len(s) - 1):
	(list_head, curr_ptr) = insert(s[i], list_head, curr_ptr)
while list_head:
	print(list_head.val)
	list_head = list_head.next


s = input()
left = []
right = []
for i in range(len(s)):
	if s[i] == 'r':
		left.append(i + 1)
	else:
		right.append(i + 1)
for i in left:
	print(i)
for i in reversed(right):
	print(i)


def solve(seq):
	stones = [0] * len(seq)
	leftPointer = 0
	rightPointer = len(seq) - 1
	index = 0
	while leftPointer <= rightPointer:
		if seq[index] == 'l':
			stones[rightPointer] = index + 1
			rightPointer -= 1
		else:
			stones[leftPointer] = index + 1
			leftPointer += 1
		index += 1
	for num in stones:
		print(num)
solve(list(input()))


from sys import stdin, stdout
from math import floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque
from heapq import merge, heapify, heappop, heappush, nsmallest
from bisect import bisect_left as bl, bisect_right as br, bisect
mod = pow(10, 9) + 7
mod2 = 998244353

def inp():
	return stdin.readline().strip()

def iinp():
	return int(inp())

def out(var, end='\n'):
	stdout.write(str(var) + '\n')

def outa(*var, end='\n'):
	stdout.write(' '.join(map(str, var)) + end)

def lmp():
	return list(mp())

def mp():
	return map(int, inp().split())

def smp():
	return map(str, inp().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(m, val) for j in range(n)]

def remadd(x, y):
	return 1 if x % y else 0

def ceil(a, b):
	return (a + b - 1) // b

def isprime(x):
	if x <= 1:
		return False
	if x in (2, 3):
		return True
	if x % 2 == 0:
		return False
	for i in range(3, int(sqrt(x)) + 1, 2):
		if x % i == 0:
			return False
	return True
s = inp()
(a1, a2) = ([], [])
for i in range(len(s)):
	if s[i] == 'l':
		a1.append(i + 1)
	else:
		a2.append(i + 1)
print(*a2, sep='\n')
print(*a1[::-1], sep='\n')


__autor__ = 'Esfandiar'
s = input()
r = list()
l = list()
c = 1
for i in s:
	if i == 'l':
		r.append(c)
	else:
		l.append(c)
	c += 1
for i in l:
	print(i)
for i in r[::-1]:
	print(i)


s = input()
n = len(s)
ll = []
rl = []
for i in range(n):
	if s[i] == 'r':
		rl.append(i)
	else:
		ll.append(i)
for i in range(len(rl)):
	print(rl[i] + 1)
n = len(ll)
for i in range(len(ll)):
	print(ll[n - 1 - i] + 1)


s = input()
n = len(s)
rt = []
lft = []
for i in range(n):
	if s[i] == 'l':
		lft.append(i + 1)
	else:
		rt.append(i + 1)
li = rt + lft[::-1]
for x in li:
	print(x)


k = input()
s = []
a = []
b = []
for i in range(len(k)):
	if k[i] == 'l':
		a.append(i + 1)
	else:
		b.append(i + 1)
a.reverse()
for i in b:
	print(i)
for i in a:
	print(i)


import sys
import string
from collections import Counter, defaultdict
from math import fsum, sqrt, gcd, ceil, factorial
from operator import add
inf = float('inf')
flush = lambda : sys.stdout.flush
comb = lambda x, y: factorial(x) // factorial(y) // factorial(x - y)
ip = lambda : input()
ii = lambda : int(input())
r = lambda : map(int, input().split())
rr = lambda : list(r())
s = ip()
a = []
b = []
for (i, j) in enumerate(s, 1):
	if j == 'l':
		a.append(i)
	else:
		b.append(i)
for i in b:
	print(i)
for i in a[::-1]:
	print(i)


s = input()
x = []
for i in range(len(s)):
	if s[i] == 'r':
		print(i + 1)
	else:
		x.append(i + 1)
x = x[::-1]
for j in range(len(x)):
	print(x[j])


s = input()
l = len(s)
arr = [0] * l
left = 0
right = l - 1
for i in range(l):
	if s[i] == 'l':
		arr[right] = i + 1
		right -= 1
	else:
		arr[left] = i + 1
		left += 1
for i in arr:
	print(i)


def solve(s):
	n = len(s)
	l = []
	r = []
	idx = 1
	for i in s:
		if i == 'l':
			l.append(idx)
		else:
			r.append(idx)
		idx += 1
	print(*r, sep='\n')
	l.reverse()
	print(*l, sep='\n')
	return
s = input()
solve(s)


from sys import stdin

class node:

	def __init__(self, n):
		self.prev = None
		self.next = None
		self.key = n

def sin():
	return stdin.readline()
s = input()
a = []
b = []
for i in range(1, len(s) + 1):
	if s[i - 1] == 'l':
		a.append(i)
	else:
		b.append(i)
for i in b:
	print(i)
for i in a[::-1]:
	print(i)


n = input()
length = len(n)
(min, max, arr1, arr2) = (1, length, [], [])
for i in range(0, length):
	if n[i] == 'l':
		arr2.append(i + 1)
	else:
		arr1.append(i + 1)
print('\n'.join(map(str, arr1)))
print('\n'.join(map(str, arr2[::-1])))


s = input()
(l, r) = (0, len(s) - 1)
a = [None] * len(s)
for (i, c) in enumerate(s, 1):
	if c == 'l':
		a[r] = i
		r -= 1
	else:
		a[l] = i
		l += 1
print(*a, sep='\n')