Skip to content

Latest commit

 

History

History

challenge-25

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Falling Dominoes

This problem was asked by Twitter.

Description

Given a string with the initial condition of dominoes, where:

. represents that the domino is standing still L represents that the domino is falling to the left side R represents that the domino is falling to the right side

Figure out the final position of the dominoes.

If there are dominoes that get pushed on both ends, the force cancels out and that domino remains upright.

Example

Input:  ..R...L..R.
Output: ..RR.LL..RR