s={c,n,l,o->def v c||[O=o,L=l] if(c)for(v=a[n++];v&&c>=0&&l<L;o+=o?' '+v:v){s(c,n,l++,o);c-=v}} System.in.eachLine{a=it.tokenize(': ')*.toLong() L=14 O='-' s(a[0],1,0,'') println O}
Note that non-ascii characters in the above source code will be escaped (such as \x9f).