There are small squares that can be represented by the string s consisting of the characters’ l ‘and’ R ‘.
The length of string s is n, that is to say, string s is arranged in a row from left to right by n small squares. The content of the i-th cell from left to right is the i-th character from left to right of string s.
The content of the leftmost grid must be ‘R’
The content of the rightmost grid must be ‘l’
At the beginning, there was a child in each cell.
The children in the grid, according to the following rules, move 10 times to 100 times.
Move according to the meaning of the characters in the current grid. For example, if "L" is written in the cell where the child is, the child will move a cell to the left. If a child's cell says "R," the child moves one cell to the right. Then, after 1000 times of doing this, find the number of children in each cell.
Require input in the following way
The number of people in each small grid from left to right after the 100th power of 10
0 1 2 1 1
- After the first move, the number of people in each cell from left to right is 0,2,1,1,1
- After the second move, the number of people in each cell from left to right is 0,1,2,1,1
- The number of people in each small grid from left to right is 0,1,2,1,1 after moving 10 to the 100th power
0 3 3 0 0 0 1 1 0 2 2 0
0 0 3 2 0 2 1 0 0 0 4 4 0 0 0 0
Read the title
The lattice doesn’t move
At the beginning, I didn’t understand the topic. I thought it was the movement of the letters in the lattice. It’s not like this
People on the grid are mobile
The lattice is fixed, and the letters in the lattice are also fixed. The people in the lattice should move to the left lattice or the right lattice according to the letters in the lattice
The left R can only be moved to the first L on the right at most, as shown in the figure, it will be bounced back to the left by the right L
As shown in the figure, where does the black dot move most?
The L on the right can only be moved to the third r on the left. As shown in the figure, the R on the left will bounce back to the R on the right
As shown in the figure, where can the + point move most?
All the points converge to the RL in the middle
As shown in the figure, by the time of step 4, all the points are gathered in the middle
The 100th power of 10 is an even number
It can be seen that step 4 and step 6 are the same, step 5 and step 7 are the same
The 100th power of 10, that is to say, it will move to step 4
Odd left, even past
Step 4 you can see that there are two columns left
What’s left of the left column?
What’s left of the column on the right?
#According to the character aggregation of RL, generate the array aggregation of numbers #Enter rrllrlrrll #Output [[2,4], [1,1], [2,2]] def calculate(S): result =  rNum = 0 lNum = 0 for i in range(len(S)): if S[i] == "L": lNum = lNum + 1 else: rNum = rNum + 1 if i > 0: if (S[i] == "R") and (S[i-1] == "L"): result.append([rNum-1,lNum]) rNum = 1 lNum = 0 if i == len(S) - 1: result.append([rNum,lNum]) return result #Easy to generate previous 0 #For example, 24 > 0xy000 def constructZero(n): res = "" for i in range(n): res = res + "0 " return res #The final result is generated here #For example, 24 > generates 0xy000 and finds X and y by the way def calculate2(arr): ret = "" for index in range(len(arr)): #Build previous 0 s1 = constructZero(arr[index]-1) s2 = constructZero(arr[index]-1) if arr[index] % 2 == 0: L1 = arr [index]  // 2. If the total number is even, leave half else: L1 = (arr [index]  + 1) // 2. If the total number is odd, leave the odd number and give the rest to the other party G1 = arr [index]  - L1 give the other half if arr[index] % 2 == 0: L2 = arr [index]  // 2. If the total number is even, leave half else: L2 = (arr [index]  + 1) // 2 // 2. If the total number is odd, leave the odd number and the rest to the other party G2 = arr [index]  - L2 give the other half #Splicing results ret = ret + s1 + str(l1 + g2) + " " + str(l2 + g1)+ " " + s2 return ret S = input() result = calculate(S) ret = calculate2(result) print(ret)