Amanda is opening a new bakery in town. She will put up a
fancy LED sign to show a grand opening message on the
storefront window. The sign has rows and columns of display units. Each
unit can display one letter or be blank.
Amanda has written a message consisting of exactly
words. She will
arrange them onto the LED sign such that each row will display
one word from the message in order. Each word must be as
centered as possible, which means that if the number of blanks
on the left side and right side of the word are and , then must be as close to zero as
possible. On those rows where cannot equal , Amanda would like to balance the
number of blanks on the two sides. More specifically, for the
first and every other such row (, , , and so forth), she
would like to be less
than . For the other
rows (,
,
, and so
forth), she would like
to be greater than .
What would the sign look like after Amanda sets it up
according to the above?
Input
The first line of input contains two integers and (), the number of
rows and the number of columns of display units.
The next lines each
contain a word with at least one and at most lowercase letters (a–z), giving the words to display
per row in order.
Output
Output lines. Each
line must contain exactly characters representing the
displayed characters on one row of the LED sign. Output a dot
(.) for each blank display unit.
Sample Input 1 |
Sample Output 1 |
8 7
welcome
we
are
open
free
coffee
for
icpc
|
welcome
..we...
..are..
..open.
.free..
.coffee
..for..
.icpc..
|