r=n=/ /=~g=gets (puts g;g[r]='';g[~n+r=S,0]=' ')while S=g.index(/ |$/,r+1)