Result

AC

Code [DL]

add = {case [], s -> ""
case [x],s -> " " + x
case [x,*y], s -> x + " " + s + add(y,s)}
join={case[]->""
case[x,*y]->x+join(y)}
stdin|map{x -> join(sort(split(add(split(add(split(add(split(add(split(add(split(add(split(add(split(add(split(add(split(add(split(x,"0"),"0"),"1"),"1"),"2"),"2"),"3"),"3"),"4"),"4"),"5"),"5"),"6"),"6"),"7"),"7"),"8"),"8"),"9"),"9"))))}|stdout

stdin

4097291474203930400728575604206529542755903480567701768411302935259766914642433040331050749988913047

stdout

0000000000000000111111122222222233333333334444444444444455555555556666666777777777778888899999999999

stderr

strace