// Символы во входном потоке следует вводить через пробел.
import java.util.*;
import java.lang.*;
import java.io.*;
class Ideone{
try{
Stack
<String
> st
= new Stack(); Stack
<String
> st2
= new Stack(); while( (line = reader.readLine()) != null){
for(int i = 0 ; i < a.length ; i++){
if(!a[i].equals("+") && !a[i].equals("-") && !a[i].equals("*") && !a[i].equals("/") && !a[i].equals("(") && !a[i].equals(")")){
a1+=a[i];
}
else{
if((a[i].equals("+") || a[i].equals("-")) && st.size()>0){
for(int j=0; j<2;j++){
if(st.size()>0){
if(!st.peek().equals("(")){
a1+=st.pop();
}
}
}
}
if((a[i].equals("*") || a[i].equals("/")) && st.size()>0){
for(int j=0; j<1;j++){
if(!st.peek().equals("(") && !st.peek().equals("+") && !st.peek().equals("-")){
a1+=st.pop();
}
}
}
if(a[i].equals(")") && st.size()>0){
for(int j=0; j<=st.size()+2;j++){
if(!st.peek().equals("(")){
a1+=st.pop();
}
}
if(st.size()!=0){
for(int j=0; j<2;j++){
if(j==0 || (j==1 && ( a[i].equals("*") || a[i].equals("/")))){
a1+=st.pop();}
}
}
}
st.push(a[i]);
}
}
for(int i = 0 ; i <= st.size() ; i++){
a1+=st.pop();
}
for(int i = 0 ; i < a1.length() ; i++){
if(a1.charAt(i)!='(' && a1.charAt(i)!=')')
System.
out.
print(a1.
charAt(i
)+" "); }
}
}
}
} // Символы во входном потоке следует вводить через пробел.
Ly8g0KHQuNC80LLQvtC70Ysg0LLQviDQstGF0L7QtNC90L7QvCDQv9C+0YLQvtC60LUg0YHQu9C10LTRg9C10YIg0LLQstC+0LTQuNGC0Ywg0YfQtdGA0LXQtyDQv9GA0L7QsdC10LsuCmltcG9ydCBqYXZhLnV0aWwuKjsKaW1wb3J0IGphdmEubGFuZy4qOwppbXBvcnQgamF2YS5pby4qOwoKY2xhc3MgSWRlb25lewoJcHVibGljIHN0YXRpYyB2b2lkIG1haW4gKFN0cmluZ1tdIGFyZ3MpIHRocm93cyBqYXZhLmxhbmcuRXhjZXB0aW9uewoJCXRye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