Please check the format of the postfix expression that is correct or not, and transform it into the infix and prefix expression and evaluate.
Please note that we specify the prefix expression should be transformed by the infix expression without redundant parenthesis.
Time Limit: 1 second
The input is a postfix expression without any space character, which is a line of string.
Each operand is a digit (0 - 9), and the set of operators are : +-*/
(plus, minus, multiply, divide).
The postfix expression includes only operands and operators mentioned above.
The length of input postfix expression is between 1 and 1000 characters.
There would be 2 cases for the output.
Note that, the output infix may contain parenthesis, but the output prefix should not contain any parenthesis.
The infix expression should contain only the necessary parenthesis and should not contain redundant parenthesis.