1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
n = int(input())
directions = input()

directions_array = []
changes_array = []
for i in range(n):
    directions_array.append(directions[i])
    changes_array.append(0)

changes = True

while changes:
    changes = False

    for i in range(n-1):
        if directions_array[i] == 'P' and directions_array[i+1] == 'L':
            changes = True
            directions_array[i] = 'L'
            directions_array[i+1] = 'P'
            changes_array[i] += 1
            changes_array[i+1] += 1

print(*changes_array)