Suki's Tile Pattern
Suki is redecorating her garden and wants to create a beautiful tiled patio using a repeating pattern. She has a small tile pattern (a square template) that she wants to repeat across a rectangular garden plot.
Given a repeating tile pattern of size p × p and dimensions n × m for her garden plot, help Suki determine what the final tiled garden will look like.
The pattern repeats both horizontally and vertically. Each cell (i, j) in the garden at row i and column j (0-indexed) will display the tile from position (i mod p, j mod p) in the pattern.
Input
The first line contains three integers n, m, and p (1 ≤ n, m ≤ 100, 1 ≤ p ≤ 10).
nis the number of rows in the garden plotmis the number of columns in the garden plotpis the size of the repeating pattern (ap × psquare)
The next p lines each contain p characters representing the tile pattern. Each character represents a different tile type.
Output
Print the final tiled garden as n lines, each with m characters, showing how the pattern repeats across the entire garden plot.
Notes
The pattern repeats infinitely in both directions. The garden plot is positioned starting at (0, 0) of this infinite repeating pattern, so position (i, j) in the garden shows the tile from position (i mod p, j mod p) in the pattern.