#t334. 前缀转后缀(prefix)
前缀转后缀(prefix)
Prefix to Postfix (prefix)
Problem Background
Special for beginners, ^_^
Problem Description
In everyday life we usually use infix expressions, but computers also use prefix and postfix expressions, whose meanings are as follows:
Prefix: write the operator first, then the first operand, then the second operand.
Postfix: write the first operand first, then the second operand, then the operator.
For example, the infix expression 3 + 4 is written as + 3 4 in prefix and 3 4 + in postfix; while (5 - 4) - 2 is - - 5 4 2 in prefix and 5 4 - 2 - in postfix.
Your task is to input a prefix expression and output the corresponding postfix expression.
Input Format
Input a prefix expression. The operators are only + and -; each operand is a single digit (0 to 9); operators and operands are separated by a single space, and the expression has no leading spaces. Every expression is valid, and there are no more than 20 operators.
Output Format
Output the corresponding postfix expression.
Sample Input
+ 3 4
Sample Output
3 4 +
Constraints
Time limit: 1s, memory limit: 1024KiB for each test case.