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
import sys
input=sys.stdin.readline
def main():
    n=int(input())
    m=input()
    R=[0]
    i=0
    while i<n:
        if m[i]=="P":
            R.append(R[-1]+1)
        else:
            R.append(R[-1])
        i+=1
    Rm=R[-1]
    #print(R)
    for i in range(n):
        if m[i]=="P":
            if R[i]<n-i-1-(Rm-R[i+1]):
                print(2*R[i]+1,end=" ")
            else:
                print(2*(n-i-1-(Rm-R[i+1])),end=" ")
        else:
            if R[i]>n-i-1-(Rm-R[i+1]):
                print(2*(n-i-1-(Rm-R[i+1]))+1,end=" ")
            else:
                print(2*R[i],end=" ")
main()