Introduction:
A typical cartoonish cactus usually looks like this:
enter image description here
One big stem in the middle, with some L-shaped branches sticking out.
We'll use this general shape for this challenge.
Challenge:
Given a pair of words, create an ASCII-art cactus with two upside down alphabets as stem. The first word is the left branch and the second word is the right branch:
E.g. input = ["cartoonish","testing"], will result in the following cactus:
zz
yy
xx g
ww n
vv i
uu t
ttes
ss
rr
qq
pp
oo
nn
mm
ll
kk
h jj
s ii
i hh
n gg
o ff
o ee
t dd
racc
bb
aa
The first letter of the words are part of the stem; then it'll grow out two letters; and continue upwards for the remaining letters.
Challenge rules:
- The words will have a guaranteed length of \5ドル \leq L \leq 99\$
- The words can start with an
a or z, even though the resulting cactus might look pretty ridiculous that way; they can also start with the same letter or even be the same.
- A word can tower above the stem (e.g.
yoghurt).
- Although leading spaces to have the correct shape are of course mandatory, one or more (additional) leading/trailing spaces or newlines are allowed. As long as the correct cactus is somewhere on the screen, it's fine.
- All the letters may be uppercase instead of lowercase, as long as its consistent across the entire 'cactus'.
- Output format is flexible, so can be printed to STDOUT; returned as a string; returned as a character-matrix; etc.
General Rules:
- This is code-golf, so the shortest answer in bytes wins.
Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language.
- Standard rules apply for your answer with default I/O rules, so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters and return-type, full programs. Your call.
- Default Loopholes are forbidden.
- If possible, please add a link with a test for your code (e.g. TIO or ATO).
- Also, adding an explanation for your answer is highly recommended.
Test Cases:
Input: ["cartoonish","testing"]
Output:
zz
yy
xx g
ww n
vv i
uu t
ttes
ss
rr
qq
pp
oo
nn
mm
ll
kk
h jj
s ii
i hh
n gg
o ff
o ee
t dd
racc
bb
aa
Input: ["yoghurt","antidisestablishmentarianism"]
Output:
t
r
u
h zz m
goyy s
xx i
ww n
vv a
uu i
tt r
ss a
rr t
qq n
pp e
oo m
nn h
mm s
ll i
kk l
jj b
ii a
hh t
gg s
ff e
ee s
dd i
cc d
bb i
aant
Input: ["cactus","stems"]
Output:
zz
yy
xx
ww
vv
uu s
tt m
sste
rr
qq
pp
oo
nn
mm
ll
kk
jj
ii
hh
gg
s ff
u ee
t dd
cacc
bb
aa
Input: ["duplicate","duplicate"]
Output:
zz
yy
xx
ww
vv
uu
tt
ss
rr
qq
pp
oo
nn
mm
ll
kk
e jj e
t ii t
a hh a
c gg c
i ff i
l ee l
puddup
cc
bb
aa
⇌⍉⬚@ (⊂⇌∩(⊂+@a⇡26≡⊂:⊟°⊂:¤↯:@ -@a°⊂)), 36 bytes \$\endgroup\$