a=int(input("")) b=input("") T=[litera for litera in b] L=[0]*a p=T.index('P') for i in range(T.count('L')): l=T.index("L") T[l]='0' if(l>p): L[l]=L[l]+1 L[p]=L[p]+1 p=p+1 for i in range(p,l): L[i]=L[i]+2 for i in range(len(L)): print(L[i],end=" ")
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | a=int(input("")) b=input("") T=[litera for litera in b] L=[0]*a p=T.index('P') for i in range(T.count('L')): l=T.index("L") T[l]='0' if(l>p): L[l]=L[l]+1 L[p]=L[p]+1 p=p+1 for i in range(p,l): L[i]=L[i]+2 for i in range(len(L)): print(L[i],end=" ") |