Skip to content

Files

Latest commit

author
Mauricio Klein
Nov 22, 2019
860754d · Nov 22, 2019

History

History

challenge-25

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