import java.util.*;
public class Main {
        public static void main(String[] args) {
            Scanner sc = new Scanner(System.in);
            while (sc.hasNextLine()) {
                int n = Integer.parseInt(sc.nextLine());
                String str = sc.nextLine();
                int[] a = new int[n];
                for (int i=0; i<n; i++) {
                    a[i] = i+1;
                }
                int start = 0;
                int head = start;
                for (int i =0; i < str.length(); i++) {
                        if (str.charAt(i) == 'U') {
                            start = start - 1 < 0 ? n - 1 : start - 1;
                            if (start == n-1) {
                                head = start -3;;
                            } else {
                                if (start < head) {
                                    head = start;
                                }
                            }
                        } else {
                             start = (start + 1) % n;
                            if (start == 0) {
                                head = start;
                            } else {
                                if (start > head + 3) {
                                    head = start -3;
                                }
                            }
                        }
                    
                 }
                int tail = head + 3;
                if (n <= 4) {
                    head = 0;
                    tail = n-1;
                }
                for (int i =head; i <= tail; i++) {
                        System.out.print(a[i] + " ");
                    }
                    System.out.println("");
                    System.out.println(a[start]);
            }
        }
}