#include<iostream>
#include<stack>
using namespace std;
int check(char a)
{
if(a >= '0' && a <= '9')
{
return 1;
}
else if(a >= 'a' && a <= 'z')
{
return 1;
}
else if(a >= 'A' && a <= 'Z')
{
return 1;
}
return 0;
}
int yxj(char a)
{
if(a == '*' || a == '/')
return 2;
if(a == '+' || a == '-')
return 1;
return -1;
}
int main()
{
stack<char> temp;
string front = "";
cin >> front;
for(long long i = 0;front[i];i++)
{
if(check(front[i]) == 1)
{
cout << front[i];
}
else if(front[i] == '(')
{
temp.emplace(front[i]);
}
else if(yxj(front[i]) == 2 || yxj(front[i]) == 1)
{
while(yxj(temp.top()) >= yxj(front[i]) && temp.size())
{
cout << temp.top();
temp.pop();
}
temp.emplace(front[i]);
}
else if(front[i] == ')')
{
while(temp.top() != '(' && temp.size())
{
cout << temp.top();
temp.pop();
}
if(temp.size()) temp.pop();
}
}
while(temp.size())
{
cout << temp.top();
temp.pop();
}
return 0;
}