1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
def count_ant(ant_directions: str):
    left_ants = ant_directions.count("L")

    prev_value = 0
    for ant in ant_directions[:left_ants]:
        if ant == "L":
            print(prev_value * 2, end=" ")
        if ant == "P":
            print(prev_value * 2 + 1, end=" ")
            prev_value += 1

    for ant in ant_directions[left_ants:]:
        if ant == "P":
            print(prev_value * 2, end=" ")
        if ant == "L":
            print(prev_value * 2 - 1, end=" ")
            prev_value -= 1

if __name__ == "__main__":
    input()
    count_ant(input())