Amin and Puzzle
Amin and Puzzle
Amin is a lover of puzzles, puzzles and crosswords. He came up with one puzzle and wants to create a frame for it. The puzzle consists of M x N letters and the frame around it should have U symbols at the top, L symbols on the left, R symbols on the right, D symbols at the bottom. The frame consists of characters # (hash) and .
(dot) which alternate like fields on a chessboard. These characters should be arranged in a way that, if the frame is expanded to cover the entire crossword
puzzle and we treat these characters as a chessboard, the # characters should be placed as the red fields on a chessboard (i.e. the top left field). See the examples below for a better understanding of the task.
Input
The first line contains two numbers M and N (1 <= M, N <= 10) The second line contains 4 numbers U, L, R, D (0 <= U, L, R, D <= 5) The next M lines contain N characters each (small characters of the English alphabet)
Output
Display a puzzle with a frame as described in the statement.
4 4 2 2 2 2 honi oker nera irak
#.#.#.#. .#.#.#.# #.honi#. .#oker.# #.nera#. .#irak.# #.#.#.#. .#.#.#.#
2 4 1 0 3 1 rima mama
#.#.#.# rima.#. mama#.# .#.#.#.