프로그램 명: coci_meteor
제한시간: 1 초

A photograph of a small meteor of an unusual shape was posted on the Internet. In that photo, the meteor is falling from a great height towards an uneven ground. There was also a photograph taken just after the meteor fell, but it is sadly lost and needs to be reconstructed.

The photograph is simplified and represented as a matrix of characters. The character ‘X’ represents a part of the meteor, the character ‘#’ represents a part of the ground and the rest of the image (air) consists of the characters ‘.’.

The meteor is connected. In other words, a path exists between each two parts of the meteor that passes only through the meteor and consists of steps up, down, left and right. Also, all parts of the ground are connected in the same way. In the given photograph, the meteor is located strictly above ground. More precisely, there is at least one row of air (dots), the meteor is completely above it and the ground is completely below it. In addition, the entire bottom row of the image is a part of the ground.

The meteor was falling vertically downward. When it fell on the ground, it kept its shape, and the same goes for the ground. Reconstruct the photograph after the meteor fall!

입력

출력

Output the required photograph (dimensions R × S) after the meteor fall.

입출력 예

입력

5 6
.XXXX.
...X..
......
#..###
######

출력

......
.XXXX.
...X..
#..###
######

입력

9 7
XXX.XXX
X.XXX.X
X..X..X
X.....X
.......
.#...#.
.##.##.
.#####.
#######

출력

.......
.......
.......
.......
XXX.XXX
X#XXX#X
X##X##X
X#####X
#######
출처:coci_2013-2014_contest6  3/6

[질/답] [제출 현황] [푼 후(0)]
[ 채 점 ] [홈으로]  [뒤 로]