#include<stdio.h> 
#include
<stdlib.h>

#define DEBUG

struct Node;
typedef 
struct Node *ptr;
typedef ptr Stack;

struct Node
{
   
char cha;
   ptr next;
       }
;
      
Stack CreatStack();
void Push(char,Stack);
void Pop(Stack);
char Top(Stack);
int IsEmpty(Stack);
void MakeEmpty(Stack);
      
int main()
{
    
char cha;
    Stack s
=CreatStack();
    
while(scanf("%c",&cha)!=EOF)
    
{
       
if(cha=='\n')
       
{
          
while(!IsEmpty(s))
          
{printf("%c",Top(s)); Pop(s);}   
          
continue;
       }
  // 清栈
       else
       
{
          
if(cha!='+'&&cha!='*'&&cha!='-'&&cha!='/'&&cha!='('&&cha!=')')
             printf(
"%c",cha);
          
else
          
{
             
if(cha=='(')
                Push(cha,s);
             
else
                 
if(cha==')')
                 
{
                    
while(Top(s)!='(')
                    
{printf("%c",Top(s)); Pop(s);}
                    Pop(s);
                 }

                 
else
                    
if(cha=='*'||cha=='/')
                    
{
                      
while(!IsEmpty(s)&&Top(s)!='+'&&Top(s)!='-'&&Top(s)!='(')
                      
{printf("%c",Top(s)); Pop(s);}
                      Push(cha,s);
                    }

                    
else
                    
{
                       
while(!IsEmpty(s)&&Top(s)!='(')
                       
{printf("%c",Top(s)); Pop(s);}
                       Push(cha,s);
                    }

          }

       }

    }

    system(
"pause");
    
return 0;
}