import java.util.Scanner;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextLine()) { // 注意 while 处理多个 case
            int n = Integer.parseInt(in.nextLine());
            String command = in.nextLine();
            // 前提条件:初始光标在1,屏幕中只能有4首歌
            int bottom = Math.min(n, 4); // 底部,总数大于4个的底部初始为4
            int index = 1; // 初始光标所在位置
            for (char c : command.toCharArray()) {
                if (c == 'U') { // up
                    if (index == 1) { // 最顶部情况处理
                        bottom = n;
                        index = n;
                    } else if (index == bottom - 3){ // 光标在顶部
                        if (n > 4) {
                            bottom--;
                        }
                        index--;
                    } else { // 底部不动,光标正常up
                        index--;
                    }
                } else { // down
                    if (index == n) { // 最底部情况处理
                        index = 1;
                        bottom = Math.min(n, 4);
                    } else if (index == bottom) { // 光标在底部
                        bottom++;
                        index = bottom;
                    } else { // 底部不动,光标正常down
                        index++;
                    }
                }
            }
            // 结果输出
            if (n <= 4) { // 4首歌以内的情况
                for (int i = 1; i <=n; i++) {
                    System.out.print(i);
                    if (i != n) {
                        System.out.print(" ");
                    }
                }
            } else { // 超过四首歌的情况
                for (int i = 3; i >= 0; i--) {
                    System.out.print(bottom - i);
                    if (i != 0) {
                        System.out.print(" ");
                    }
                }
            }
            System.out.println();
            System.out.println(index);
        }
    }
}