@@ -0,0 +1,549 @@
+import java.util.*;%0A%0Apublic class Main %7B%0A    public static void main(String%5B%5D args) %7B%0A        Scanner sc = new Scanner(System.in);%0A        sc.nextLine();%0A        char%5B%5D array = sc.nextLine().toCharArray();%0A        LinkedList%3CString%3E list = new LinkedList%3CString%3E();%0A        int i = 1;%0A        for (char c : array) %7B%0A            String s = String.valueOf(i);%0A            if (c=='L')%0A                list.addFirst(s);%0A            else%0A                list.add(s);%0A            i++;%0A        %7D%0A        System.out.println(String.join(%22 %22, list));%0A    %7D%0A%7D%0A

Create Main.java