a=[k=p=i=0] j=20 System.in.text[0..-2].each{v->a[j]=(a[j+=vp?-1:0]?:'').padRight(i++)+(p=v)} while(k++