#P7550. Enlarge Bold Characters in a Letter Matrix
Enlarge Bold Characters in a Letter Matrix
Enlarge Bold Characters in a Letter Matrix
Paula wrote a letter for Daniel. The letter is represented as a matrix of characters, where each character is either a '.' or a '#'. In order to help Daniel, whose eyesight is worsening, Paula wants to bold every '#' character. For each '#' in the original letter, you must expand it to a 2 \times 2 block of '#' characters. That is, if the original letter cell at row i and column j is '#' then in the output, the cells at positions (i, j), (i, j+1), (i+1, j) and (i+1, j+1) must be '#' (overwriting any '.' in those positions).
Input and Output dimensions: The input letter is given as an n \times m matrix, and the output should be a matrix of dimensions (n+1) \times (m+1).
inputFormat
The first line contains two integers n
and m
separated by space, representing the number of rows and columns of the input letter matrix. The following n
lines each contain a string of length m
, consisting only of characters '.' and '#'.
outputFormat
Output the resulting matrix after the expansion. The resulting matrix has n+1
rows and m+1
columns. Each '#' in the original input should expand to a 2 \times 2 block of '#' characters in the output. All other positions should be filled with '.'.
sample
2 2
##
#.
###
##.
</p>