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
liczba_mrowek = int(input())
a = [[0,0] for _ in range(liczba_mrowek)]
mrowki = input()

counter = 0
for i in range(liczba_mrowek):
    a[i][0] = counter
    if mrowki[i] == 'P':
        counter += 1

counter = 0
for i in range(1, 1+liczba_mrowek):
    a[-i][1] = counter
    if mrowki[-i] == 'L':
        counter += 1

#print(mrowki)
#print(a)

for i in range(liczba_mrowek):
    if mrowki[i] == 'L':
        a[i] = a[i][::-1]

for i in range(liczba_mrowek-1):
    i = a[i]
    if i[0] >= i[1]:
        print(i[1]*2, end=" ")
    #elif i[0] == i[1]:
        #print(i[1]*2, end=" ")
    else:
        print(i[0]*2+1, end=" ")

i = a[-1]
if i[0] >= i[1]:
    print(i[1]*2)
else:
    print(i[0]*2+1)
#print(a)