def move(orders):
    pos, min_pos = 0, 0 # 光标位置, 当前页面最小值
    for order in orders:
        if order == 'U':
            pos = (pos-1) % n  # 一般上翻页
            if pos == n-1: #  第一页到最后一页特殊上翻页
                min_pos = n-4
            else:
                if pos < min_pos:
                    min_pos = pos
        elif order == 'D':
            pos = (pos+1) % n  # 一般下翻页
            if pos == 0:  # 最后一页到第一页特殊下翻页
                min_pos = 0
            else:
                if pos > min_pos + 3:
                    min_pos = pos - 3
    return pos, min_pos

while True:
    try:
        n = int(input())
        orders = input()
        p, min_p = move(orders)
        res = list(range(min_p+1, min_p+5)) if n > 4 else list(range(1, n+1))
        print(*res)
        print(p+1)
    except:
        break