Write two programs, each taking a string s
and a number n
≥ 0, such that:
- The first program prints
s
n
times, separated by newlines. - The second program prints each character of
s
n
times, with repeated characters separated by newlines. - Every character at column
x
, liney
in one program equals the character at columny
, linex
in the other program.
Both programs must contain at least two lines. You may take input in any reasonable order or format that works for both programs.
This is code-golf; the less bytes, the better. Count bytes from your longer program (that is, the one with more lines than columns).
Here's an example in a hypothetical programming language, with s
= "Hello, world!"
and n
= 3
:
Program A
a(b*c
defg
h.ij)
Output
Hello, world!
Hello, world!
Hello, world!
Program B
adh
(e.
bfi
*gj
c )
Output
HHH
eee
lll
lll
ooo
,,,
www
ooo
rrr
lll
ddd
!!!
s
first thenn
, and the other taken
thens
? \$\endgroup\$