n = int(input())
s = input()

idx = 0
song = 0

for ch in s:
    if ch == 'U':
        if idx > 0 or idx == 0 and song == 0:
            idx = (idx + 3) % 4
        song = (song + n - 1) % n
    else:
        if idx < 3 or idx == 3 and song == n-1:
            idx = (idx + 1) % 4
        song = (song + 1) % n

if n <= 4:
    for i in range(n):
        print(i+1, end=' ')
    print()
else:
    for i in range(4):
        print(1 + song - idx + i, end=' ')
    print()
print(song + 1)