#!/bin/sed -f
:
s/[1-9]/&s/g
y/123456789/012345678/
s/s0/9s/
t
s/\(ss*\) 0*\1\>/ \1-/
t
s/[^-]*/-/
:1
s/-/<<123456789-01>/
s/\(.\)<.*\1\(-*.\).*>/\2/
t1