1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
#include <iostream>
using namespace std;
int res[300005], f, l, n, c;
string w;
int main(){
	cin >> n >> w;
	while (w[f] == 'L')f++;
	for (l = f; l < n; l++)
		if (w[l] == 'L') {
			res[f]++;
			res[f + 1]++;
			res[l]--;
			res[l + 1]--;
			f++;
		}
	for (f = 0, c = res[0]; f < n; f++, c += res[f])cout << c << ' ';
}