#1179
Unrated
METEOR
시간 제한
1s
메모리 제한
64MB
제출
0
정답
0
맞힌 사람
0
정답 비율
0.0%

문제

1 second, 64 MB, 100 points 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!

입력

The first line of input contains the integers R and S (3 ⩽R, S ⩽3 000), the number of rows and the number of columns of the photograph. The following R lines contain the photograph described in the task.

출력

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

예제 입력 1

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

예제 출력 1

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

예제 입력 2

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

예제 출력 2

.......
.......
.......
.......
XXX.XXX
X#XXX#X
X##X##X
X#####X
#######
코드 제출

코드를 제출하려면 로그인이 필요합니다.

로그인
내 제출
제출 내역이 없습니다.
맞은 사람
아직 맞은 사람이 없습니다.
난이도 투표
Unrated0명 투표
로그인 후 AC 받으면 투표할 수 있습니다.
전체 제출
제출 내역이 없습니다.