**Objective: **Given a Prefix expression, write an algorithm to convert it into Postfix expression.

**Example**:

Input: Prefix expression:+ A BOutput: Postfix expression:A B +Input: Prefix expression:*-A/BC-/AKLOutput: Postfix expression:ABC/-AK/L-*

**Approach**: Use Stacks

**Algorithm:**

Iterate the given expression from right to left, one character at a time

- If the character is operand, push it to the stack.
- If the character is operator,
- Pop an operand from the stack, say it’s s1.
- Pop an operand from the stack, say it’s s2.
- perform
**(s1 s2 operator)**and push it to stack.

- Once the expression iteration is completed, initialize the result string and pop out from the stack and add it to the result.
- Return the result.

Please walk through the example below for more understanding.

**Java Code:**

**Output:**

Prefix Expression: *-A/BC-/AKL Postfix Expression: ABC/-AK/L-*