#include<stdio.h>
#include<string.h>
#include<ctype.h>
#define max 100
char stack[max];
int top=-1;
int isOperator(char c){
    return(c=='+' || c=='-'|| c=='*' || c=='/');
}
int precedence(char ch){
   
    if(ch=='+' || ch=='-')return 1;
     if(ch=='*' || ch=='/')return 2;
     return 0;
}
int main(){
    char infix[max],postfix[max]="";
    char op[max];
    int optop=-1;
    scanf("%s",infix);
    for(int i=0;infix[i]!='\0';i++){
        char ch=infix[i];
        if(isalnum(ch)){
            char temp[2];
            temp[0]=ch;
            temp[1]='\0';
            strcat(postfix,temp);
        }
        else if(ch=='('){
            op[++optop]=ch;
        }
        else if(ch==')'){
            while(!optop != -1 && op[optop]!= '('){
                char temp[2];
                temp[0]=op[optop--];
                temp[1]='\0';
                strcat(postfix,temp);
            }
            if(optop==-1){
                printf("Invalid input");
                return 0;
            }
            optop--;
        }
        else if(isOperator(ch)){
            while(!optop != -1 && precedence(op[optop])>=precedence(ch)
                char temp[2];
                temp[0]=op[optop--];
                temp[1]='\0';
                strcat(postfix,temp);
            }
            op[++optop]=ch;
    }
     else{           printf("Invalid input");
                return 0;