1574 - Snowflakes in YangShen’s Home

Time Limit : 1 Second

Memory Limit : 128 MB

Submission: 437

Solved: 161

Description
         YangShen is super boy, and his house is super too. His house has only one window, which is on the right wall, and the direction of gravity in his house is different from which in your house – direct to left.

         One winter day, YangShen go to super boy school with the window opened. About noon, the weather starts getting snowy, and some snowflakes drift in his house from the window.

         Mr. He, a close friend of YangShen, is very curious about the final position of each snow- flakes, can you generate the picture?


Input
    Multiple cases, you need to process to EOF.

    Each case starts with two integers N and M, which are seperated by a single space.

    Each line of the fllowing N lines contains M chars, which describe one row of snowflakes.

    N and M are all in the range of [1, 100].

    Each char is only can be ‘~’, ‘*’, ‘&’, ‘$’, ‘%’, ‘#’, ‘.’.

    A ‘.’ indicates a blank space, where the snowflakes in its right will drift to.

 

Output
    Print the final picture of each case.

    A blank line is need after each case(including the last case).

sample input
1 2
.#
1 2
.$
1 3
~.~
sample output
#.

$.

~~.
hint
source
Yan DONG
© 2015 HUST ACMICPC TEAM. All Right Reserved.