Presort array by hallvabo

while 1:
 p=t=[]
 for e in input():t+=[[]]*(e<p);t[-1]+=e,;p=e
 print`sum(sorted(t),[])`.replace(' ','')

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

download

return top