package stackProblems1;
import java.util.ArrayDeque;
public class InfixPrefixPostfix {
static boolean isOperator(char c) {
return c == '+' || c == '-' || c == '*' || c == '/';
}
static int precedence(char c) {
if(c == '+' || c == '-') return 1;
else if(c == '*' || c == '/') return 2;
else return -1;
}
static int calculate(int a, int b, char c) {
switch(c) {
case '+':
return a+b;
case '-':
return a-b;
case '*':
return a*b;
case '/':
return a/b;
}
return 0;
}
static String infixToPostfix(String s) {
StringBuilder sb = new StringBuilder();
ArrayDeque