Salarios77 wants to send a postcard to atarw but mailing is expensive. He notices that a good portion of a grid is just white paper, so output the smallest rectangular design that will encompass all of the black ink!
The first line will contain integers ~N~ (rows), ~M~ (columns) (separated by space).
Subtask 1 [10%]
~2 \le N, M \le 5~
Subtask 2 [10%]
~2 \le N, M \le 100~
Subtask 3 [80%]
~2 \le N, M \le 1000~
The following line will contain the design, with
. representing white space and
* being black (separated by spaces).
Note: Fast input may be required.
Output the grid in its smallest form.
4 4 . * * . . . . . . . . . . * * .
* * . . . . * *