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

def count_collisions(n, sequence):
    directions = [1 if x == 'P' else -1 for x in sequence]
    result = [0 for _ in range(0, n)]

    def collision(directions, i):
        if (i != 0) & (directions[i-1] == 1) & (directions[i] == -1):
            directions[i-1] *= -1
            directions[i] *= -1
            result[i-1] += 1
            result[i] += 1
            collision(directions, i-1)

    for i in range(1, n):
        collision(directions, i)            

    return ' '.join([str(x) for x in result])

print(count_collisions(n, sequence))