Crossword puzzle decoration
Time limit1sMemory limit128 MB
Surround the M by N letter grid with the given padding and fill the added cells with alternating # and . by row plus column parity.
- Level
Easy1 of 10
- Topics
- Implementation, Matrix
- Solved
- No attempts yet
Problem
Changyeong likes crossword puzzles. He has solved every puzzle in the world, so now he wants to decorate one.
A puzzle is a grid of letters. Changyeong adds rows above the puzzle, columns to its left, columns to its right, and rows below it. The finished decoration is a rectangle with rows and columns.
The added cells are filled with # and . so that they alternate like a chessboard. Let be the cell in row from the top and column from the left of the finished rectangle. A cell with even holds #, and a cell with odd holds .. The top left cell is therefore #. Cells that the original puzzle occupies keep their letters.
Input
The first line contains and . ()
The second line contains , , , and . ()
Each of the next lines contains letters of the crossword puzzle.
Output
Print the decorated crossword puzzle on lines. Each line has characters.