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
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 2137
#endif

const int N = 300300;
int n;
string s;
int a[N];

void dod(int l, int r, int x) {
  a[l] += x;
  a[r] -= x;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n >> s;
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == 'L') {
      if (i > cnt) {
        dod(cnt, cnt + 1, 1);
        dod(cnt + 1, i, 2);
        dod(i, i + 1, 1);
      }
      cnt++;
    }
  }
  for (int i = 0; i < n; i++) {
    a[i + 1] += a[i];
  }
  for (int i = 0; i < n; i++) {
    cout << a[i] << " \n"[i == n - 1];
  }
}