import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while(in.hasNextInt()){
            int n = in.nextInt();
            String s = in.next();
            int targe = 1;
            // ********************************歌曲数<=4
            if(n<=4){
                // 输出当前列表
                for(int i=1;i<=n;i++){
                    System.out.print(i+" ");
                }
                System.out.println();
                // 输出当前选中歌曲
                for(int i=0;i<s.length();i++){
                    switch(s.charAt(i)){
                        case 'U':
                            if(targe == 1){
                                targe = n;
                            }else{
                                targe--;
                            }break;
                        case 'D':
                            if(targe == n){
                                targe = 1;
                            }else{
                                targe++;
                            }break;
                    }
                }
                System.out.println(targe);
            }
            // *********************************歌曲数>4
            else{
                // 寻找当前选中歌曲和当前列表
                int head = 1, last = 4;        // head:页面的第一首歌的编号;last:页面的最后一首歌的编号
                for(int i=0;i<s.length();i++){
                    switch(s.charAt(i)){
                        case 'U':
                            if(targe == 1){
                                targe = n;
                                head = n-3;
                                last = n;
                            }else{
                                if(targe-1 >= head){
                                    targe--;
                                }else{
                                    targe--;
                                    head--;
                                    last--;
                                }
                            }break;
                        case 'D':
                            if(targe == n){
                                targe = 1;
                                head = 1;
                                last = 4;
                            }else{
                                if(targe+1 <= last){
                                    targe++;
                                }else{
                                    targe++;
                                    head++;
                                    last++;
                                }
                            }break;
                    }
                }
                // 输出当前列表
                while(head<=last){
                    System.out.print(head+" ");
                    head++;
                }
                System.out.println();
                // 输出当前选中歌曲
                System.out.println(targe);
            }
        }
    }
}