There are ancient columns in a row, numbered from to from left to right. Column initially has height .
A sequence of storms hits the columns. Each storm blows from the left (L) or from the right (R). It destroys every part of a column that is higher than all columns on the side from which the wind blows.
All changes during one storm are simultaneous and use the heights immediately before that storm. A column with no other column on that side is destroyed completely. Destroyed columns have height zero, and their positions remain empty.
Formally, if the current heights are , a storm L replaces every height by
A storm R uses instead. The maximum of an empty set is zero.
The string specifies the storm directions in chronological order. Find the final heights .
L or R.After the storm, the heights are . After the storm, they are .
The two storms destroy the first two columns. The storm destroys the last column. The remaining three columns keep height .