30
2
Given a list of at least two words (made only of lowercase letters), construct and display an ASCII ladder of the words by alternating the direction of writing first to the right, then to the left, relatively to the initial direction from left to right.
When you finish writing a word, change the direction and only then start writing the next word.
If your language doesn't support lists of words, or it's more convenient for you, you can take the input as a string of words, separated by a single space.
Leading and trailing whitespaces are allowed.
["hello", "world"]
or "hello world"
hello
w
o
r
l
d
Here we start by writing hello
and when we come to the next word (or in the case of the input as a string - a space is found), we change the relative direction to the right and continue to write world
Test cases:
["another", "test", "string"] or "another test string" ->
another
t
e
s
tstring
["programming", "puzzles", "and", "code", "golf"] or "programming puzzles and code golf" ->
programming
p
u
z
z
l
e
sand
c
o
d
egolf
["a", "single", "a"] or "a single a" ->
a
s
i
n
g
l
ea
Wining criteria
The shortest code in bytes in every language wins. Don't let be discouraged by the golfing languages!
1Related – Bassdrop Cumberwubwubwub – 2019-05-23T07:48:23.517
1@Arnauld Yes, I'll add it to the description. – Galen Ivanov – 2019-05-23T09:04:25.890