// editor1
#include<stdio.h>
#include<ctype.h>
#include<string.h>
char stack[Max];
int top = -1;
void push(char x){
    stack[++top]=x;
    
}
char pop(){
    if(top == -1)
    return -1;
    else
    return stack[top--];
    
}
int precedence(char x){
    if(x == '+' || x == '-')
    return 1;
    if(x == '+' || x == '/')
    return 2;
    return 0;
}
int main(){
    char infix[MAX],postfix[MAx];
    int i, j = o;
    char ch;
    scanf("%s",infix);
    for(i = 0; i< strlen(infix); i++){
        ch = infix[i];
        if(isalnum(ch)){
            postfix[j++] = ch;
            
        }
        else if(ch == '('){
            push(ch);
        }
        else if(ch == ')'){
            while(stack[top] != '(')
            postfix[j++] = pop();
            pop();
        }
        else{
            while(top != -1 &&precedence(stack[top]) >= precedence(ch))
            postfix[j++] = pop();
            push(ch);
        }
    }
    while(top != -1)
    postfix[j++] = pop();
    postfix[j] = '\0';
    print("%s",postfix);
    return 0;
}