# Julia, 112 bytes <!-- language-all: lang-default --> s->(x=[sum(i->i==10,s),endof(split(s,r"\s",keep=1<0)),sizeof(s)];join(map(i->lpad(i,maximum(ndigits,x)),x)," ")) This is an anonymous function that accepts a string and returns a string. To call it, assign it to a variable. My internet went out right before I was going to post this so I'm posting from mobile. I'll add an explanation once my internet comes back. :/