Back
Close
  • 517

Statement

The program:
The program must output the given map, making the # fall to the bottom of the grid.

The map is composed of '.' and '#'.
INPUT:
Line 1 : Two integers: The map width width and height height.
height next lines : width characters: (. or #).
 
OUTPUT:
height lines : width characters where the # are at the bottom of the grid.
 
CONSTRAINTS:
0 < width < 100
0 < height < 10
 
EXAMPLE:
Input
17 5
...#...#.#.#...#.
.#..#...#....#...
..........#......
..###...###..##..
#################
Output
.................
.................
...##...###..#...
.####..#####.###.
#################
 

A higher resolution is required to access the IDE