Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int a[800000];
- int n;
- int curLeft = 399999;
- int curRight = 400001;
- cin >> n;
- string s;
- cin >> s;
- for (int i = 1; i < n; i++) {
- if (s[i - 1] == 'R') {
- a[curRight] = i;
- curRight++;
- } else {
- a[curLeft] = i;
- curLeft--;
- }
- }
- for (int i = curLeft + 1; i < curRight; i++) {
- cout << a[i] << " ";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement