Presort array by mroman

while 1:
 t=[[]];l=0
 for e in input():t[-1]+=[e]*(e>=l);t+=[[e]]*(e<l);l=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