while 1: a=[];b=[] for e in input():[a,b][sum(a)>sum(b)]+=[e] print`a,b`.replace(' ','')

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

download

return top