IntermediateRating 1400
Falling Dominoes
Each domino is pushed left (L), pushed right (R), or upright (.). A falling domino pushes its neighbour the same way each second; a domino pushed from both sides at once stays up. Print the final state.
Input
One string of L, R and .
Output
One string.
Sample 1
Input
.L.R...LR..L..
Output
LL.RR.LLRRLL..
Sample 2
Input
RR.L
Output
RR.L
Output appears here