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