# Print a string with vertical words

Your task is to take an input string of ascii characters and output the string as a series of vertical words separated by spaces. An example is shown below:

Given the string:

Hello, World! My name is Foo.


the output should be:

H W M n i F
e o y a s o
l r   m   o
l l   e   .
o d
, !


10 bonus points will be awarded if your program correctly handles strings which need to wrap-around the terminal, which we'll set at 80 characters.

50 points if your program can also do the reverse!

• Quite similar to Transpose a page of text. – manatwork Feb 21 '14 at 12:29
• @manatwork: I suppose it is. It's not identical though - and I might argue my problem is a little easier. – Foo Barrigno Feb 21 '14 at 12:31
• It's not 100% identical, but it's close enough to count as a duplicate: the reduction to make it identical is just replacing each space with two newlines. – Peter Taylor Feb 21 '14 at 14:04
• @PeterTaylor: Not quite. My problem has no requirement to respect newlines in the original string. That problem requires that new lines be converted into spaces, and spaces converted into two newlines. It's not quite a trivial reduction. – Foo Barrigno Feb 21 '14 at 14:09

i=split(readline());m=maximum(map(x->length(x),i));for c∈1:m println(join([rpad(w,m)[c] for w∈i]," "))end