[Question]
  [
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`, line `y` in one program equals the character at column `y`, line `x` 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](/questions/tagged/code-golf "show questions tagged '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
!!!
```
  
[Answer]
# C, 196 bytes
**Regular version: 190 bytes**
```
p;f(char *s,n) { 
; while( p++<  n)
puts(s);p; }   /*
f*******u*0**;* /
(///////t/)//}+*
c*)dfppnc(;p(w+/
hs{oo=+;h* u"hs}
a, {r0+)a /t"i)/
rn  (;< r *s l;*
/////// /  / e/ 
******* *  * (*/
```
**Mirrored version: 196 bytes**
```
p;pf(char/*
; u*/*s,n/*
fwt*/){  /*
(hs*/do{ /*
ci(*/for(/*
hls*/p=0;/*
ae)*/p++</*
r(;*/n;)   
  putchar/*
*p;+*/(*   
s+ 0); /*  
,+}*/puts/*
n< */(""   
)  ;}while(
   *++s);/*
{n/ */}/* /
 )*/
```
**Readable regular version:**
```
p; f(char* s, n) {
  ;
  while (p++ < n)
    puts(s);
  p;
}
```
**Readable mirrored version:**
```
p; pf(char* s, n) {
  do {
    for (p = 0; p++ < n; )
      putchar (*s + 0);
    puts("");
  } while (*++s);
}
```
[Answer]
# [MATL](https://github.com/lmendo/MATL), 11 bytes
Inputs are `s`, then `n`.
**Normal version** (10 bytes):
```
1!X"
XDD
"
```
[Try it online!](https://tio.run/##y00syfn/31AxQokrwsWFS@n/f3WP1JycfB2F8vyinBRFdS5jAA) 
**Mirrored version** (11 bytes):
```
1X"
!D
XD
"
```
[Try it online!](https://tio.run/##y00syfn/3zBCiUvRhSvChUvp/391j9ScnHwdhfL8opwURXUuYwA)
### Explanation
The **normal version** is parsed as
```
1    % Push 1
!    % Transpose: does nothing to the 1
X"   % Implicit inputs: n, s. Repeat s n times vertcally and 1 time horizontally 
XD   % Display the full stack contents. This prints the output
D    % Display. Triggers implicit input, which is not present, and so errors
"    % For each. This statement is not reached
```
The **mirrored version** is parsed as
```
1    % Push 1
X"   % Implicit inputs: n, s. Repeat s n times vertcally and 1 time horizontally 
!    % Transpose. This transforms the above into the desired output
D    % Display. This prints the output
XD   % Display all stack contents. The stack is empty, so this does nothing
"    % For each. Triggers implicit input, which is not present, and so errors
```
[Answer]
# perl, 102 bytes
```
$_=<>;$n=<>;print$_ x$n
__END__
=E
<N
>D
;_
$_
;
=
<
>
;
s
/
.
/
$
&
x
$
;
.
"
\
n
"
/
g
e
;
p
r
i
n
t
```
[Try it online!](https://tio.run/##FYi7CoNAFAX7@QqRS8rYaLWPSlu/QLhEMEEI67Ja@Pebm@LMYSZv5TvUKhp8dJL@zGVPl2hzS0J1mkdVwoSfiSNOEcUR8ET7k46nTXhwG51Zy0IydnzYrGQKu5Wr1vdxNOur0P8A "Perl 5 – Try It Online")
```
$_=<>;$;=<>;s/./$&x$;."\n"/ge;print
__END__
=E
<N
>D
;_
$_
n
=
<
>
;
p
r
i
n
t
$
_
 
x
$
n
```
[Try it online!](https://tio.run/##FcexCoMwFEDR/X6FyMPRLHZ6SSZd/QLh0YIVocSQOvj3qV3u4ea1fB61igUfVfTfr@uddJdo3y6pdduquezpxGyaRzPChJ@JI2qIkQh4IkqmsN9/IhgN122q9X0czetZGH4 "Perl 5 – Try It Online")
The programs are fairly trivial, they just do what is required without any trickery. The only trickery is the `__END__`; this tells perl to ignore anything what is following. That way, hardly anything is shared between the two programs, only the first two bytes are: `$_`, where the `_` is either the name of the variable, or the first character of the `__END__` token.
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 20 bytes
```
ＥＮη¿⁰«
Ｎ
η
‖
↙
¿
⁰
«
```
[Try it online!](https://tio.run/##S85ILErOT8z5///9nqXv96w7t/3Q/keNGw6t5gJyuM5t53rUMI3rUdtMrkP7uYDiXIdW//9vzOWRmpOTr6NQnl@Uk6L4XzcRAA "Charcoal – Try It Online") Explanation:
```
ＥＮη
```
Convert the input number to an implicit range, map each entry to the input string, and print the result.
```
¿⁰
```
Execute the rest of the program only if `0` is true (which it isn't).
```
«
```
Wrap the rest of the program in a block, so it doesn't matter what its meaning is, since it never gets executed.
Reflected:
```
ＥＮη‖↙¿⁰«
Ｎ
η
¿
⁰
«
```
[Try it online!](https://tio.run/##S85ILErOT8z5///9nqXv96w7t/1Rw7RHbTMP7X/UuOHQai6gENe57VyH9nMB@VyHVv//b8zlkZqTk6@jUJ5flJOi@F83EQA "Charcoal – Try It Online") Explanation: Much like the other program, except that the `‖↙` reflects the output as desired.
[Answer]
# [05AB1E (legacy)](https://github.com/Adriandmen/05AB1E/tree/fb4a2ce2bce6660e1a680a74dd61b72c945e6c3b), 6 bytes
-1 byte thanks to @dingledooper.
```
иø
»
q
```
[Try it online!](https://tio.run/##MzBNTDJM/f//wo5Duwu5Du/4/9@YyyM1JydfR6E8vygnRREA "05AB1E (legacy) – Try It Online")
## Explanation (Horizontal)
```
и   Sequence product.
 ø  Transpose this product.
»   Join the product by newlines.
q   Exit the program.
```
## Explanation (transposed)
```
и   Sequence product.
 »  Join the product by newlines.
  q Exit the program.
A garbage dump the interpreter ignores:
ø
```
```
[Answer]
# [Python 2](https://docs.python.org/2/), 95 bytes
**First program: 94 bytes**
```
sfp,n=input();"\
,or";s=sfp+"\n"
print s*n;  """
= n
ict
n  
pic
un*
t p
(s;
):"
#""
"""
1;
#\
```
[Try it online!](https://tio.run/##FcoxDoMwEATAfl9xWhogbohS5eSfuENBWELnEzZFXu@QdjT@bXuxZ@9182Axm19tnJQJoZzUGm9/MBnhZ7YmdTYVIYkohrw2mAg8r7hsRhPHWBXTmxju83@LYki9c/8cR2GQ1w8 "Python 2 – Try It Online")
**Second program: 95 bytes**
```
s,p=input()#"1#
for c in s:"";\
print c*p;"""
,"n
n;t
=s 
i=s
ns*
pfn
up;
t+ 
(" 
)\"
;n"
"""
\
```
[Try it online!](https://tio.run/##FcoxDoMwEATAfl9xWhogbkCpYvkn7lAQltD5hI8ir3fE1GM/P6quvbdgqajdPk4DlwF7vWSTotI@ZMywq6jLNlskiUCFRkdqgpIatM2wXXFbhL8EIwVTJqISz8@98/ieZ2WQ9x8 "Python 2 – Try It Online")
[Answer]
# [Perl 5](https://www.perl.org/) + `-pF`, 51 bytes
I feel I can condense this more so I'll likely tinker with it to try and make it more square...
```
$_=$_ x<>;'
; f
=xo
<$r
>;@
;.F
$$;
\/}
.|{
=| 
$$'
```
[Try it online!](https://tio.run/##K0gtyjH9/18l3lYlXqHCxs5anctaIY3LtiKfy0aliMvO2oHLWs@NS0XFmitGv5ZLr6aay7ZGAchX///fIzUnJ19HITy/KCdFkcv4X35BSWZ@XvF/3QI3AA "Perl 5 – Try It Online")
### Explanation
Basically this just runs `$_=$_ x <>` which, since `-p` flag is used, will just print out the string triplicated. The rest of the string is avoid by being inside a single quote.
```
$;=<>;$\.=$
_ x$;.$/||$
=for@F;}{'
$
_
 
x
<
>
;
'
```
[Try it online!](https://tio.run/##K0gtyjH9/1/F2tbGzlolRs9WhSteoULFWk9Fv6ZGhcs2Lb/Iwc26tlqdCyjBpcBVwWXDZcdlzaX@/79Hak5Ovo5CeH5RTooil/G//IKSzPy84v@6BW4A "Perl 5 – Try It Online")
### Explanation
This takes `n` from STDIN (`<>`) and stores in `$;`, next the magic variable `$\` (which is automatically output as the final argument to any call to `print`) is appended to with `$;` copies of `$_`. `$_` is set to each letter of the input during the `for@F`. We need to also close the implicit `while (<STDIN>)` loop (that is added via `-p`) with `}{` so that the global `$_` is empty and when `print` is called, only `$\` is output.
[Answer]
# Mathematica, 114 bytes
Mathematica, with it's long, unsplittable names means that no matter how short I make this, it'll still have obtuse names, the alternative of using <> and #&/@ would be shorter for either individual program, but dealing with them in the transposition makes the program longer overall.
```
StringRiffle[
t;Table[##],1*
rT;"\n"]&(*  )
ia
nb
gl
Re
i[
f#
f#
l]
e]
[
C,
h"
a\
rn
a"
c,
t"
e"
r]
s&
[(
1*
*)
```
**Normal**
```
StringRiffle[Characters[1*
t;Table[##]],"\n",""]&(*)
rT;
ia"
nb\
gln
Re"
i[]
f#&
f#(
l]*
e,
[1
 *)
```
**Transposed**
### Base programs:
Normal:
StringRiffle[Table[##],"\n"]&
Transposed:
StringRiffle[Characters[Table[##]],"\n",""]&
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 10 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
Unfortunately, for this challenge, the execution of a Jelly program starts with the bottom line of code, so there's quite a bit of work required to get a solution under about 25 bytes!
```
W ñ
ẋY
Z
ñ
```
**[Try it online!](https://tio.run/##y0rNyan8/z9c4fBGroe7uiO5orgOb/z//78HUDxfR6E8vygnRfG/MQA "Jelly – Try It Online")**
```
WẋZñ
 Y
ñ
```
**[Transposed](https://tio.run/##y0rNyan8/z/84a7uqMMbuRQiuQ5v/P//vwdQOF9HoTy/KCdF8b8xAA "Jelly – Try It Online")**
### How?
Normal:
```
W ñ - Link 1: s, n
W   - wrap (s) in a list
  ñ - call the next Link (2) as a dyad - f(that, n)
ẋY - Link 2: wrapped s, n
ẋ  - repeat (s) (n) times
 Y - join with newlines
Z - Link 3 (unused)
ñ - Main Link: s, n
ñ - call the next Link (1) as a dyad - f(s, n)
  - implicit (smashing) print
```
Transposed:
```
WẋZñ - Link 1: s, n
W    - wrap (s) in a list
 ẋ   - repeat (that) (n) times
  Z  - transpose
   ñ - call the next Link (2) as a dyad - f(that, n)
 Y - Link 2: transposed, repeated [s]
 Y - join with newlines
ñ - Main Link: s, n
ñ - call the next Link (1) as a dyad - f(s, n)
  - implicit (smashing) print
```
[Answer]
# [Stax](https://github.com/tomtheisen/stax), 6 bytes
```
]
*M
m
```
[Run and debug it](https://staxlang.xyz/#c=]%0A*M%0Am&i=8+%22hello%22&a=1&m=2)
**Mirrored:**
```
]*m
 M
```
[Run and debug it](https://staxlang.xyz/#c=]*m%0A+M&i=8+%22hello%22&a=1&m=2)
]