G=[' '*999]*99 p=r=20;i=0 for c in raw_input():r+=c<p;r-=c>p;G[r]=G[r][:i]+c+G[r][i+1:];i+=1;p=c for s in G: s=s.rstrip() if s:print s
Note that non-ascii characters in the above source code will be escaped (such as \x9f).
download
return to the top page