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
def main():                                                                     
    liczba_mruwkuw = int(input())                                               
    strony = input()                                                            
    buff = []                                                                   
    wynik = []                                                                  
    for direction in strony:                                                    
        buff.append([direction, 0])                                             
        if direction == "L":                                                  
            dlugosc = len(buff) - 1                                             
            for i in range(dlugosc, -1, -1):                                    
                if buff[i][0] == "P":                                           
                    buff[i][0] = "L"                                            
                    buff[i][1] += 1                                             
                    buff[i+1][0] = "P"                                          
                    buff[i+1][1] += 1                                           
                                                                                
            wynik.append(str(buff[0][1]))                                       
            del buff[0]                                                         
                                                                                
    for value in buff:                                                          
        wynik.append(str(value[1]))                                             
    print(" ".join(wynik))                                                      
                                                                                
if __name__ == "__main__":                                                      
    main()