Help! My device malfunctions and whenever I try to repeat a String, I get a messy results. Instead of repeating the same string N times, it fills an NxN square with each of its characters, and stacks the squares up.
For example, given the String "Test"
and the number 2
, instead of "TestTest"
, I get:
TT
TT
ee
ee
ss
ss
tt
tt
After I have seen this for a while, I started to like it. Your task today is to reproduce this strange behaviour. Given a non-empty string that consists of printable ASCII only, and a positive integer, output the String my malfunctioning device returns.
All standard rules apply.
The input and output may be handled through any reasonable mean.
This is code-golf, so the shortest code in bytes in each language wins.
Test Cases
Input Output ---------- "Test", 2 TT TT ee ee ss ss tt tt ---------- "UuU", 3 UUU UUU UUU uuu uuu uuu UUU UUU UUU ---------- "A", 5 AAAAA AAAAA AAAAA AAAAA AAAAA ----------
You can find a larger test case here. Good luck and have fun golfing!
it fills an NxN square
- Not a correct statement. \$\endgroup\$*
Only works on your machine. \$\endgroup\$