while True:
    try:
        #获取歌曲数量
        n1 = int(input())
        #获取指令
        s1 = input()
        #构建字典
        d = {'D':+1,'U':-1}
        #设置标签用于处理不同情况
        flag = 0
        #设置计数器,用于记录光标的位置
        num = 1
        #定义空数组用于存储输出列表
        res = []
        if n1 <= 4:
            flag = 1
        if flag == 1:
            res = [n for n in range(1,n1+1)]
            for word in s1:
                num = num + d[word]
                if num == 0:
                    num = n1
                elif num == n1 + 1:
                    num = 1
        if n1 > 4:
            flag = 2
        #记录当前列表的头尾值
        first = 1
        end = 4
        
        if flag == 2:
            for word in s1:
                num = num + d[word]
                if num == 0:
                    num = n1
                    first = n1-3
                    end = n1
                elif num == n1+1:
                    num = 1
                    first = 1
                    end = 4
                elif num == first-1:
                    first = first-1
                    end = end-1
                elif num == end+1:
                    end = end+1
                    first = first+1
                elif first <= num <= end:
                    continue
            res = [k for k in range(first,end+1)]
        #输出结果
        print(' '.join(str(ans) for ans in res))
        print(num)
            
        
        
    except:
        break