Prefix Notation to Postfix Notation Disclaimer: No, this is not a joke challenge to reverse a string.

Task

There is only one operation to support: subtraction (-).

You also only have two atoms to support: zero (0) and one (1).

Here, the prefix notation -AB is equivalent to the postfix notation AB-, where A and B are expressions.

Your task is to (recursively) convert an expression in prefix notation to its equivalent in postfix notation.

Definitions

An expression in prefix notation is generated by the following grammar:

S &gt; -SS
S &gt; 0
S &gt; 1


An expression in postfix notation is generated by the following grammar:

S &gt; SS-
S &gt; 0
S &gt; 1


Example

Prefix notation:  --01-0-01
Parentheses:      -(-01)(-0(-01))
Convert:          (01-)(0(01-)-)-
Postfix notation: 01-001---


Rules and freedom


You may rename the operation and the atoms to whichever character, as long as it is consistent.
The input format must be consistent with the output format (apart from the fact that the input is in prefix notation and the output is in postfix notation).


Testcase

Input       Output
1           1
0           0
-01         01-
-10         10-
--01-0-01   01-001---


Testcases credits to Dada.
brainfuck, 32 bytes

,[[-&gt;++++&lt;&lt;+&gt;]&gt;[[-]&lt;&lt;[.[-]&lt;]]&gt;,]


Try it online!

I used @ as the operation, because its code point (64) is convenient.  U is also possible with the same byte count, using 3*85+1=256=0.

Explanation

The tape is used as a stack.  In each iteration of the main loop, the data pointer starts two cells right of the top of the stack.

,[                Take input and start main loop
  [-&gt;++++&lt;&lt;+&gt;]    Push input, and compute 4*input
  &gt;[              If 4*input is nonzero (and thus input is not @):
    [-]&lt;&lt;           Zero out this cell and move to top of stack
    [.[-]&lt;]         Pop from stack and output until \0 is reached
  ]
  &gt;,              Move pointer into the correct position.  If input was @, the earlier &gt; pushed \0 onto the stack.
]