import java.io.*;
import java.lang.String;
class nodo
{
char car;
nodo sig = null;
public nodo() {}
public nodo(char car)
{
this.car = car;
}
char Tope()
{
return car;
}
}
public class Inf_Pos
{
nodo opstk = null;
nodo aux = null;
String cad = "8+3*2", POSTFIJA="";
int k=0;
char symb, topsymb;
public static void main(String[] Args) { new Inf_Pos(); }
public Inf_Pos()
{
while(cad.length() > k)
{
symb = cad.charAt(k);
if ( EsOperando(symb) ) POSTFIJA = POSTFIJA+symb;
else
{
while ((opstk != null) && prcd(opstk.Tope(), symb )>0 )
{
topsymb = opstk.car;
opstk = opstk.sig;
POSTFIJA = POSTFIJA+topsymb;
}
aux = new nodo(symb);
aux.sig = opstk;
opstk = aux;
}
k++;
}
while ( opstk != null )
{
topsymb = opstk.car;
opstk = opstk.sig;
POSTFIJA = POSTFIJA + topsymb;
}
System.out.println(POSTFIJA);
}
int prcd(char Tope, char CAR)
{
if ( "*/".indexOf(CAR) > 0) return 1;
if ( "+-".indexOf(CAR) > 0) return 2;
return 3; // ERROR
}
boolean EsOperando(char CAR)
{
String numeros = "0123456789";
if (numeros.indexOf(CAR) > 0 ) return true;
return false;
}
}