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
#include <bits/stdc++.h>
using namespace std;
#define rep(a, b) for (int a = 0; a < (b); a++)
#define rep1(a, b) for (int a = 1; a <= (b); a++)
#define all(x) (x).begin(), (x).end()
#define printrange(s, e) {for (auto it = s; it < e; it++) {cout << *it << ' ';} cout << '\n';}
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int MOD = 1e9 + 7;

#define LOCAL false

const int MAX_N = 3e5 + 7;
int n;
string str;

int Ppref[MAX_N];
int Lsuff[MAX_N];

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    if (LOCAL) {
        ignore=freopen("io/in", "r", stdin);
        ignore=freopen("io/out", "w", stdout);
    }

    cin >> n;
    cin >> str;

    rep(i, n) Ppref[i+1] = Ppref[i] + (str[i]=='P');
    for (int i = n-1; i >= 0; i--) Lsuff[i+1] = Lsuff[i+2] + (str[i]=='L');
    rep(i, n) {
        int p = Ppref[i];
        int l = Lsuff[i+2];
        cout << 2*min(p, l) + (str[i] == 'L' ? (p>l) : (l>p)) << ' ';
    }
    cout << '\n';

    return 0;
}