while 1:t=[],[];[min(t,key=sum).append(v)for v in input()];print`t`.replace(" ","")