import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
while (in.hasNext()) {
int n = in.nextInt();
String str = in.next();
int start = 1, end = Math.min(n, 4);
int index = 1;
for (int i = 0; i < str.length(); i++) {
if (str.charAt(i) == 'U')
index = (index - 1 - 1 + n) % n + 1;
else if (str.charAt(i) == 'D')
index = index % n + 1;
if (index < start) {
start = index;
end = start + 3;
} else if (index > end) {
end = index;
start = end - 3;
}
}
for (int i = start; i <= end; i++) {
System.out.print(i + " ");
}
System.out.println();
System.out.println(index);
}
}
}