[요약] . 은 바다이고 , X 는 육지이다. 50 년후에 바다수위가 상승해서 3 면 혹은 4 면이 접해있는 육지는 바다에 잠긴다.
50 년후의 지도를 출력하는게 문제이다. 출력되는 부분은 육지를 포함하는 최소 직사각형이다. 단, 처음 주어지는 바깥 경계선은 바다이고 적어도 한 부분은 육지로 남는다는 것은 보장된다.
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.
input 5 3 ... .X. .X. .X. ... output X input 3 10 .......... ..XXX.XXX. XXX....... output .XX...X XX.....
출처:coci/2012-2013/contest5 2번/6