Advertisement
niromru

Untitled

Nov 5th, 2021
652
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.33 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int n;
  8.     cin >> n;
  9.     string s, g = "0";
  10.     cin >> s;
  11.     for (int i = 1; i < n; i++) {
  12.         if (s[i - 1] == 'R') {
  13.             g += " " + to_string(i);
  14.         } else {
  15.             g = to_string(i) + " " + g;
  16.         }
  17.     }
  18.     cout << g << endl;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement