Scanner
InterviewTime limit1sMemory limit128 MB
Expand an R by C character grid by repeating each character ZR times vertically and ZC times horizontally, then print the result.
- Level
Easy2 of 10
- Topics
- Simulation, Implementation, Array
- Solved
- No attempts yet
Problem
A student reads a newspaper every morning. As the print has become too small to read comfortably, the student wants to use a scanner to enlarge the text.
A newspaper article can be represented as a matrix of R*C characters. Each character is a letter, a digit, or a period.
The scanner receives two integers, ZR and ZC. It enlarges every original 1*1 character into a block that is ZR characters tall and ZC characters wide.
Given the article and the enlargement factors ZR and ZC, write a program that prints the scanned result.
Input
The first line contains four integers R, C, ZR, and ZC. R and C are between 1 and 50, inclusive, and ZR and ZC are between 1 and 5, inclusive.
Each of the next R lines contains one string representing a row of the newspaper article. Each string has length C.
Output
Print the enlarged scanner result over R*ZR lines. Each output line must contain exactly C*ZC characters.