s=' '*50 n=0 while 1: \x09for x in raw_input():n+=x>s>s[-1];s=s[1:]+(`n`+x*('#'>x)+s)[x<s] \x09print s

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return top