1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include <bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
using namespace std;



using ll = long long;
using ld = long double;

//#define int ll
#define sz(x) ((int)(x).size())

using pii = pair<int,int>;
using tii = tuple<int,int,int>;

const int nmax = 3e5 + 5;
int rez[nmax];

signed main() {
  cin.tie(0) -> sync_with_stdio(0);
  int n;
  cin >> n;
  
  deque<int> deq;
  
  int offset = 0;
  
  for(int i = 0; i < n; i++) {
    char ch;
    cin >> ch;
    if(ch == 'L') {
      offset += 2;
      rez[i] = -offset + 1;
      deq.emplace_back(i);
      rez[deq.front()] += offset - 1;
      deq.pop_front();
    }
    else
      rez[i] = -offset,
      deq.emplace_back(i);
  }
  
  for(auto x : deq) rez[x] += offset;
  
  for(int i = 0; i < n; i++)
    cout << rez[i] << ' ';
  cout << '\n';
  
}

/**
  Anul asta nu se da centroid
  -- Rugaciunile mele
*/