Author: | A. Klenin | Time limit: | 1 sec | |
Input file: | input.txt | Memory limit: | 256 Mb | |
Output file: | output.txt |
A pile of boulders is represented by a rectangular field of H rows with W columns each. Each element is either '.' (ASCII 46) representing empty space, 'o' representing a small boulder, or 'O' representing a large boulder.
A boulder is considered stable if at least one of the following is true:
Your program must remove minimal possible number of boulders from the pile so that the pile becomes stable.
First line of input contains integers W H. Following H lines contain W characters each — pile representation.
Output must contain H lines of W characters each — stable pile representation.
If there is more than one optimal solution, output any of them.
1 ≤ W, H ≤ 1000
No. | Input file (input.txt ) |
Output file (output.txt ) |
---|---|---|
1 |
|
|
2 |
|
|
3 |
|
|