Groovy web console

subscribe to the feed Subscribe
to this
site

transpose

Published 4 years ago by yariash with tags codegolf
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
def input ="""I am a text. 
Transpose me. 
Can you do it?""";

{i->o=[].withDefault{''};i.readLines().each{it.toList().eachWithIndex{c,d->o[d]+=c}};o.join('\n')}(input)