No.3420 Letter Loading
o vertically, with $4,1,3$ packages from left to right
Problem Statement
You are given a string $S$ of length $N$, and the width $W$ and height $H$ of a cargo bed.
The space above the cargo bed is divided into a grid of cells of width $1$ and height $1$. The cell corresponding to the space between $x$ and $x+1$ from the left and between $y$ and $y+1$ from the bottom is called $(x,y)$.
Each package has width $1$ and height $1$, and is stacked so that it fits exactly into a grid cell. Here, for $h>0$, when a package is stacked at $(w,h)$, a package must exist at $(w,h-1)$.
$S$ represents the arranged packages and dividers, and consists of two kinds of characters: o representing a package and l representing a divider. Read $S$ from the front, starting at $(0,0)$; for each o, fill $1$ cell and move to the cell above, and for each l, move to the bottom cell of the column to the right.
Display x at the places where no o is stacked, and output the result.
Please refer to the sample.
Constraints
- $1 \leq N \leq 2549$
- $1 \leq W,H \leq 50$
- $N,W,H$ are all integers
- $S$ is a string of length $N$ consisting of
oandl - The number of
lin $S$ is at most $W-1$ - The number of packages stacked in $1$ column is at most $H$
Input
$N$ $W$ $H$ $S$
Output
Output the result of stacking the packages.
Sample
Sample 1
Input
Separated by the dividers l, the packages o are lined up in groups of $4,1,3$ in order
10 3 5 oooololooo
Output
Stack the packageso vertically, with $4,1,3$ packages from left to right
xxx oxx oxo oxo ooo
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
まみめ
kidodesu