题目描述
You are given a string that represents the prefix form of a valid mathematical expression. Convert it to its postfix form.
Example:
Input:
-A/BC-/AKL
Output:
ABC/-AK/L-
Explanation:
The above output is its valid postfix form.
Your Task:
Complete the function preToPost(string pre_exp), which takes a prefix string as input and returns its postfix form.
Expected Time Complexity: O(N).
Expected Auxiliary Space: O(N).
Constraints:
3<=pre_exp.length()<=100
输入格式
见题面
输出格式
见题面
样例输入
*-A/BC-/AKL
样例输出
ABC/-AK/L-*