there n domino line place domino vertically upright in beginning simultaneously push domino leave rightAfter second domino fall leave push adjacent domino leave Similarly domino fall right push adjacent domino stand rightWhen vertical domino dominoe fall side stay balance forcesFor purpose question consider fall domino expend additional force fall fallen dominoYou give string domino represent initial state wheredominoesi L ith domino push leftdominoesi R ith domino push right anddominoesi ith domino pushedReturn string represent final state Example 1input domino RRLOutput RRLExplanation the domino expend additional force second dominoexample 2input domino lrlrloutput LLRRLLRRLL Constraintsn dominoeslength1 n 105dominoesi L R