while True:
    try:
        n = int(input())
        actions = input()
        act_dict = {'U':-1,'D':1} #字典操作加减
        songs = [str(x) for x in range(1,n+1)]  #歌曲列表
        start = 0 #第一格歌曲切片位置
        end = 4   #第4格歌曲切片位置(不含)
        guangbiao = 1 #光标歌曲
        guangbiaoweizhi = 1 #光标在第几格
        if  n <= 4:
            for i in actions:
                guangbiao += act_dict[i]
                if guangbiao < 1:
                    guangbiao = n
                if guangbiao > n:
                    guangbiao = 1
            else:
                print(' '.join(songs))
                print(guangbiao)
        else:
            for i in actions:
                guangbiao += act_dict[i]
                guangbiaoweizhi += act_dict[i]
                if guangbiaoweizhi > 4:
                    guangbiaoweizhi = 4
                    start += act_dict[i]
                    end += act_dict[i]
                    if guangbiao == n+1:
                        guangbiao = 1
                        guangbiaoweizhi =1
                        start = 0
                        end = 4
                if guangbiaoweizhi < 1:
                    guangbiaoweizhi = 1
                    start += act_dict[i]
                    end += act_dict[i]
                    if guangbiao == 0 :
                        guangbiao = n
                        guangbiaoweizhi = 4
                        start = n-4
                        end = n

            else:
                face = songs[start:end]
                print(' '.join(face))
                print(guangbiao)
    except:
        break