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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <unordered_map>
#include <string>
#include <queue>
#include <deque>
#include <set>
#include <cstdlib>
#include <ctime>
#include<chrono>
#include<thread>
#include<iomanip>
#include<fstream>
#include<time.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second


using namespace std;

typedef struct {
    char val;
    int left;
    int right;
} Mrowka;
int main()
{
    int n;
    cin >> n;
    string a;
    cin >> a;
    int amountOfL = 0;
    int amountOfR = 0;
    for(int i = 0; i < n; i++) {
        if(a[i] == 'L') amountOfL++;
        else amountOfR++;
    }
    vector <Mrowka> b;
    int leftL = 0;
    int leftR = 0;
    for(int i = 0; i < n; i++) {
        if(i > 0) {
            if(a[i - 1] == 'L') leftL++;
            else leftR++;
        }
        if(a[i] == 'L') {
            amountOfL--;
            b.push_back({a[i], leftR, amountOfL});
        }
        else {
            amountOfR--;
            b.push_back({a[i], leftR, amountOfL});
        }
    }
    vector<int> ans;
    for(int i = 0; i < n; i++) {
        if(b[i].val == 'L') {
            if(b[i].left > b[i].right) ans.push_back(b[i].right * 2 + 1);
            else ans.push_back(b[i].left * 2);
        }
        else {
            if(b[i].right > b[i].left) ans.push_back(b[i].left * 2 + 1);
            else ans.push_back(b[i].right * 2);
        }
    }
    for(auto i : ans) {
        cout << i << " ";
    }
    return 0;
}