Import Java. io. bufferedreader; import Java. io. ioexception; import Java. io. inputstreamreader; import Java. util. imports; import Java. util. stack; public class main {// convert the infix expression to the suffix expression public static void main (string [] ARGs) throws ioexception {writable SC = new writable (New bufferedreader (New inputstreamreader (system. in); stack <character> stack = new stack <character> (); // stack for saving operators. push ('#'); string strmid = NULL ;// Save the infix expression string strafter = NULL; // Save the suffix expression system. out. println ("Enter the infix expression to be converted:"); strmid = SC. next (); For (INT I = 0; I <strmid. length (); I ++) {Switch (strmid. charat (I) {Case ')': While (stack. peek ()! = '(') {Strafter = strafter + stack. pop ();} stack. pop (); // Delete the left brace break in the stack; Case '#': While (stack. peek ()! = '#') {Strafter = strafter + stack. pop ();} break; Case '+': Case '-': Case '*': Case '/': Case '(': While (compare (strmid. charat (I), stack. peek () {strafter = strafter + stack. pop ();} stack. push (strmid. charat (I); break; default: strafter = strafter + strmid. charat (I); break;} system. out. println ("infix expression:" + strmid); system. out. println ("suffix expression:" + strafter. replaceall ("null", "");} public static char infix_prior Ity [] = {'#', ')', '+ ','-','*','/','('}; public static char stack_priority [] = {'#', '(', '+ ','-','*','/'}; public static Boolean compare (char infix, char stack) {// comparison operator priority int I = 0, j = 0; while (infix_priority [I]! = Infix) {I ++;} while (stack_priority [J]! = Stack) {J ++;} Boolean bool = (INT) (J/2) >=( I/2 )? True: false; return bool ;}}