Interleave strings

Jelly, 1 byte

Z

Try it online!

The “transpose” built-in will do exactly this to a list of strings.


Python 2, 101 89 86 69 bytes

I'm hoping I can get this into a lambda somehow, shortening it down by making it recursive. It isn't ideal because you would hope transposing is shorter, unfortunately it isn't (from what I have managed to come up with so far).

f=lambda s:' '*any(s)and''.join(x[:1]for x in s)+f([x[1:]for x in s])

Old solutions:

w=input();o=''
while any(w):
 for i in range(len(w)):o+=w[i][:1];w[i]=w[i][1:]
print o

lambda s:''.join(''.join([c,''][c<' ']for c in x)for x in map(None,*[list(y)for y in s]))

w=input();o=''
while any(x>=' 'for x in w):
 for i in range(len(w)):o+=w[i][:1];w[i]=w[i][1:]
print o

thanks to mathmandan for making me feel dumb ;) saved me a bunch of bytes! (on an old solution)


Perl 6, 34 32 bytes

{[~] flat roundrobin |$_».comb}

{roundrobin(|$_».comb).flat.join}

A lambda that takes an array of strings as argument, and returns a string.

(Try it online)