|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||512 MB||72||58||55||80.882%|
You would like to implement a simple simulation of gravity on a 2-dimensional grid, consisting of n rows and m columns.
Some grid cells may contain obstacles, some may contain a single apple, and all others are empty.
The following rules are followed until no further changes are possible:
Find the final configuration of the grid after all apples have settled.
The first line of input contains two space-separated integers n and m (1 ≤ n, m ≤ 50).
Each of the next n lines contains m characters, describing the board, from top to bottom. Obstacles are denoted as ‘#’, apples are denoted as ‘o’, and empty cells are denoted as ‘.’.
Print, on n lines, the final configuration of the grid after executing the rules stated above.
3 3 ooo #.. ..#
o.. #.o .o#
4 2 oo oo o. ..
.. o. oo oo