Bold
InterviewTime limit1sMemory limit512 MB
Expand each '#' in an n by m grid into a 2x2 block extending right and down, and print the resulting grid.
- Level
Easy3 of 10
- Topics
- Implementation, Matrix, Simulation, Brute force
- Solved
- No attempts yet
Problem
Along with the usual age-related health problems, such as the first signs of RSI1 and physical injuries that accumulate faster than they heal, Daniel's eyesight has suddenly worsened.
Paula wrote him a letter, but he can't read it without glasses. She needs to bold the text so Daniel can read it.
The letter can be represented as a matrix of characters '.' and '#'. To bold it, Paula replaces each '#' in the original letter with a 2 × 2 square of '#' extending down and to the right.
1Repetitive strain injury. Never ignore the pain caused by typing. Ergonomic aids and chairs are generally always worth it. Sit straight. "A gram of prevention is worth a kilo of cure."
Input
The first line contains integers n and m (2 ≤ n, m ≤ 100), the dimensions of the letter.
Each of the following n lines contains m characters '.' and '#' that represent Paula's letter.
The last row and column contain no '#'.
Output
Output n lines of m characters '.' and '#' representing the bold letter.