1574 - Snowflakes in YangShen’s Home

Time Limit: 1s Memory Limit: 128MB

Submissions: 437 Solved: 161
         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?

    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.
    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