類問:

implementation

sed 160byte

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