#include "Header.h"
#include "stock00.h"
vector<string> postfix_to_infix(const vector<string>& postfix)
{
stack<string> numstack;
string a, b;
for (const auto& x : postfix)
{
if (isdigit(x[0]))
{
numstack.push(x);
}
else
{
b = numstack.top(), numstack.pop(), a = numstack.top(), numstack.pop();
numstack.push(std::move("( " + a + " " + x + " " + b + " )"));
}
}
a = numstack.top();
vector<string> ret;
stringstream ss;
ss << a;
while (ss >> b)
{
ret.push_back(b);
}
return ret;
}
int main()
{
vector<string> postfix{ "1", "2", "3", "*", "+", "4", "5", "*", "6", "+", "7", "*", "+"};
vector<string> infix = postfix_to_infix(postfix);
for (const auto& x : infix)
{
cout << x;
}
}