#Retina, 19 17 bytes
Retina, 19 17 bytes
Replace the number with unary, with a zero on the end. Replace each 1
with -~
. Remove double negative if there is one.
\d+
$*10
1
-~
--
All test cases at once (slightly modified program to support multiple test cases)