Uiua 0.11.0, 26 bytes SBCS
▽:+@\0◿256\+-⬚0↻¯1,∩=@+,@-
Takes a string of +
and -
and returns the output string. If the input is guaranteed to only contain +-
, we can save 2 bytes by replacing ∩=@+,@-
with ¬.=@-
(and probably more, with a completely different strategy).
Explanation
@- # push literal character - to stack
@+, # dup input to top and push +
∩= # get two arrays with 1s where + and - are
, # dup the - array to top
⬚0↻¯1 # shift 1 to the left, filling with 0 at front
- # subtract from the + array
\+ # plus scan: cumulative sums
◿256 # mod 256
+@\0 # add literal character null, converts to ASCII
▽: # flip the - array to top and apply mask