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