Print a string with vertical words

J, 15

|:>'\S+| 'rxall

Usage:

   |:>'\S+| 'rxall 'Hello, World! My name is Foo.'
H W M n i F
e o y a s o
l r   m   o
l l   e   .
o d        
, !        

Javascript - 228 172 145 126

A=prompt().split(" "),B="",N=A;for(y=0;y<N.length;y++){for(i=0;i<N.length;i++){if(A[i][y]){B+=A[i][y];}else{B+=" ";}}B+="\n";}

My first code golf :)


APL, 22

{⍉⊃⍵⊂⍨1+0,+\2≠/⍵=' '}

Explanation

{              ⍵=' '}   A. check which chars are spaces           
            2≠/         B. of that vector, which consecutive pairs are different  
          +\            C. compute the partial sums                           
      1+0,              D. insert 0 at the front and add 1 to every item
   ⍵⊂⍨                     use this vector to split the original string
 ⍉⊃                        disclose into a matrix and transpose

    'W o w   S u c h   D o g e'
A.   0 0 0 1 0 0 0 0 1 0 0 0 0
B.    0 0 1 1 0 0 0 1 1 0 0 0
C.    0 0 1 2 2 2 2 3 4 4 4 4
D.  1 1 1 2 3 3 3 3 4 5 5 5 5

Example

      {⍉⊃⍵⊂⍨1+0,+\2≠/⍵=' '} 'Hello, World! My name is Foo.'
H W M n i F
e o y a s o
l r   m   o
l l   e   .
o d        
, !