while True:
try:
n = int(input())
str_input = input()
# 总数小于等于4时
if n <= 4:
# 当前选中歌曲
now = 1
for c in str_input:
if c == 'U':
if now == 1:
now = n
else:
now -= 1
if c == 'D':
if now == n:
now = 1
else:
now += 1
print(' '.join([str(i) for i in range(1, n + 1)]))
print(now)
else:
# 总数大于4时
# 当前选中歌曲
now = 1
# 当前屏幕第一首歌曲
screen_first = 1
for c in str_input:
if c == 'U':
if now == 1:
now = n
screen_first = n - 3
elif now == screen_first:
now -= 1
screen_first -= 1
else:
now -= 1
if c == 'D':
if now == n:
now = 1
screen_first = 1
elif now == screen_first + 3:
now += 1
screen_first += 1
else:
now += 1
print(' '.join([str(i) for i in range(screen_first, screen_first + 4)]))
print(now)
except:
break