#include<stdio.h>
typedef struct{
char data[100005];
int top;
}SqStack; //栈
void initStk(SqStack &stk){
stk.top = -1;
}
void push(SqStack &stk,char s){
stk.data[++stk.top] = s;
}
int cmp1(char stk1){
int a1;
if(stk1 == '+' || stk1 == '-') a1 = 1;
if(stk1 == '*' || stk1 == '/') a1 = 2;
if(stk1 == '(') a1 = 0;
return a1;
}
bool cmp(char op1,char op2){
int a1,a2;
a1 = cmp1(op1);
a2 = cmp1(op2);
if(a1 >= a2) return true;
return false;
}
char com(int num1,int num2,char s){
if(s == '+') return (num1 + num2) + '0';
if(s == '-') return (num1 - num2) + '0';
if(s == '*') return (num1 * num2) + '0';
if(s == '/') return (num1 / num2) + '0';
}
void word(SqStack &nums,char s){
int num1 = nums.data[nums.top--] - '0'; //先出来的是右运算符
int num2 = nums.data[nums.top--] - '0';
printf("%d %c %d\n",num1,s,num2);
//push(nums,com(num2,num1,s));//运算完后压入栈
}
int main(){
SqStack op,nums;
initStk(op);
initStk(nums);
char s[100005];
scanf("%s",s);
int i = 0;
int sum = 0;
while(s[i]!='\0'){
if(s[i]>='0' && s[i]<='9'){
push(nums,s[i]);
}
else if(s[i]=='+' || s[i]=='-'||s[i]=='*'||s[i]=='/'){
//先检查栈中元素的优先级, 栈顶运行算大的和相等的 可以先算出
while(op.top!=-1 && cmp(op.data[op.top],s[i])){
word(nums,s[i]);
printf("%c",nums.data[nums.top]);
}
push(op,s[i]);
}
else if(s[i] == '('){
push(op,s[i]);
}
else{//右括号,此时数字栈中只有+-法,向前找到左括号即可
while(op.data[op.top] != '('){
char s = op.data[op.top--];
word(nums,s);
}
op.data[op.top--];
}
i++;
}
while(op.top!=-1){
word(nums,op.data[op.top--]);
}
printf("%c",nums.data[nums.top]);
}