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
def mro(s: str):
    n = len(s)
    ls = s.count('L')
    ps = n - ls

    result_left = []
    result_right = []

    ls_seen = 0
    ps_seen = 0

    for i, c in enumerate(s[:ls]):
        result_left.append(2 * (i - ls_seen))

        if c == 'L':
            ls_seen += 1
        else:
            result_left[-1] += 1

    for i, c in enumerate(s[::-1][:ps]):
        result_right.append(2 * (i - ps_seen))

        if c == 'P':
            ps_seen += 1
        else:
            result_right[-1] += 1


    result = result_left + result_right[::-1]
    return result

n = int(input())
s: str = input()

result = mro(s)
print(' '.join([str(x) for x in result]))