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

[요약] . 은 바다이고 , X 는 육지이다. 50 년후에 바다수위가 상승해서 3 면 혹은 4 면이 접해있는 육지는 바다에 잠긴다.

50 년후의 지도를 출력하는게 문제이다. 출력되는 부분은 육지를 포함하는 최소 직사각형이다. 단, 처음 주어지는 바깥 경계선은 바다이고 적어도 한 부분은 육지로 남는다는 것은 보장된다.


A popular tourist destination country is situated on a breathtakingly beautiful archipelago constantly bathed by the sun. The country's residents are very proud of their numerous islands. However, global warming has them very worried: raising sea levels are resulting in rapidly increasing loss of dry land, which is diminishing the beauty of the archipelago.

The map of the archipelago is represented by a grid of R by C squares (characters). The character 'X' (uppercase letter x) represents dry land, while '.' (period) represents sea. It has been estimated that, in fifty years, sea will have flooded every square of land that is currently surrounded by sea on three or on all four sides (north, south, east, west). Assume that all squares outside the map (along the edges) are covered by sea.

Your task is computing the map of the archipelago in fifty years (after the described sea level rise). Since there will probably be less land than today, you shouldn't print out the whole map, but only its smallest rectangular part that contains all land squares. It is guaranteed that at least one square of land will remain in all test cases.

입력

출력

The output must contain an appropriate number of lines representing the required rectangular part of the future (flooded) map.

입출력 예

input

5 3
...
.X.
.X.
.X.
...

output

X

input

3 10
..........
..XXX.XXX.
XXX.......

output

.XX...X
XX.....
출처:coci/2012-2013/contest5 2번/6

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