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
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
#include <bits/stdc++.h>
#include <unistd.h>
using namespace std;
#ifdef DEBUG
auto&operator<<(auto &o, pair<auto, auto> p) {o << "(" << p.first << ", " << p.second << ")"; return o;}
auto operator<<(auto &o, auto x)->decltype(x.end(), o) {o<<"{"; for(auto e : x) o<<e<<", "; return o<<"}";}
#define debug(X) cerr << "["#X"]: " << X << '\n';
#else 
#define cerr if(0)cout
#define debug(X) ;
#endif
#define ll long long
#define all(v) (v).begin(), (v).end()
#define ssize(x) int(x.size())
#define fi first
#define se second
#define mp make_pair
#define eb emplace_back

namespace 
{
	int fastin() {
		int n = 0, c = getchar_unlocked();
		while(isspace(c))
			c = getchar_unlocked();
		while(isdigit(c)) {
			n = 10 * n + (c - '0');
			c = getchar_unlocked();
		}
		return n;
	}
	char buf[400'000*10];
	char *buf_ptr = buf;

	void write_char(char c) {
		*buf_ptr++ = c;
	}

	constexpr inline unsigned long 
	build_long(char c1, char c2, char c3, char c4, char c5, char c6, char c7, char c8) {
		unsigned long n = c8;
		n <<= 8;
		n |= c7;
		n <<= 8;
		n |= c6;
		n <<= 8;
		n |= c5;
		n <<= 8;
		n |= c4;
		n <<= 8;
		n |= c3;
		n <<= 8;
		n |= c2;
		n <<= 8;
		n |= c1;
		return n;
	}

	template <bool LeadingZeroes> struct output {
		
		constexpr output() {
			char lead = LeadingZeroes ? '0' : ' ';

			for(unsigned long c1 = 1; c1 <= 9; ++c1) 
				for(unsigned long c2 = 0; c2 <= 9; ++c2) 
					for(unsigned long c3 = 0; c3 <= 9; ++c3) 
						for(unsigned long c4 = 0; c4 <= 9; ++c4) 
							for(unsigned long c5 = 0; c5 <= 9; ++c5) 
								arr[10'000*c1+1'000*c2+100*c3+10*c4+c5] = build_long('0'+c1, '0'+c2, '0'+c3, '0'+c4, '0'+c5, ' ', '0', '0');
				
			for(unsigned long c2 = 1; c2 <= 9; ++c2) 
				for(unsigned long c3 = 0; c3 <= 9; ++c3) 
					for(unsigned long c4 = 0; c4 <= 9; ++c4) 
						for(unsigned long c5 = 0; c5 <= 9; ++c5) 
							arr[1'000*c2+100*c3+10*c4+c5] = build_long(lead, '0'+c2, '0'+c3, '0'+c4, '0'+c5, ' ', '0', '0');

			for(unsigned long c3 = 1; c3 <= 9; ++c3) 
				for(unsigned long c4 = 0; c4 <= 9; ++c4) 
					for(unsigned long c5 = 0; c5 <= 9; ++c5) 
						arr[100*c3+10*c4+c5] = build_long(lead, lead, '0'+c3, '0'+c4, '0'+c5, ' ', '0', '0');

			for(unsigned long c4 = 1; c4 <= 9; ++c4) 
				for(unsigned long c5 = 0; c5 <= 9; ++c5) 
					arr[10*c4+c5] = build_long(lead, lead, lead, '0'+c4, '0'+c5, ' ', '0', '0');

			for(unsigned long c5 = 0; c5 <= 9; ++c5) 
				arr[c5] = build_long(lead, lead, lead, lead, '0'+c5, ' ', '0', '0');
		}

		array<unsigned long, 100'000> arr{};
	};

	constexpr output<true> out_lz;
	constexpr output<false> out_ls;

	void write_long(unsigned long l, unsigned long n) {
		*reinterpret_cast<unsigned long*> (buf_ptr) = l;
		buf_ptr += n;
	}

	pair<unsigned long, unsigned long> podziel(unsigned long a, unsigned long b) {
		return {a/b, a%b};
	}

	void write_int(unsigned long x) {
		if(x >= 100'000) {
			auto [a, b] = podziel(x, 100'000);
			write_long(out_ls.arr[a], 5);
			write_long(out_lz.arr[b], 6);
		} else {
			write_long(out_ls.arr[x], 6);
		}
	}
}

int main() {

	int n = fastin();
	vector<int> a(n);
	for(int i = 0; i < n; ++i) {
		char c;
		c = getchar_unlocked();
		a[i] = c == 'L' ? 0 : 1;
	}

	vector<int> ans(n);

	int l = 0, r = n-1;
	int x = 0;
	while (l <= r) {
		while (a[l] == 0 && l <= r) ans[l++] = x;
		while (a[r] == 1 && l <= r) ans[r--] = x;
		if(l > r) break;
		assert(a[l] == 1 && a[r] == 0);
		ans[l] = ans[r] = 1 + x;
		++l; --r;
		x += 2;
	}

	for(auto e : ans) write_int(e);
	write(STDOUT_FILENO, buf, buf_ptr-buf);

	return 0;
}