<awangdev>1106. Parsing A Boolean Expression_3.java
public boolean parseBoolExpr(String exp) {
        Stack<Character> stack = new Stack<>();
        for (char c : exp.toCharArray()) {
            if (c == ')') {
                Set<Character> expItems = new HashSet<>();
                while (stack.peek() != '(') expItems.add(stack.pop());
                stack.pop(); 
                char op = stack.pop();
                if (op == '&') stack.push(expItems.contains('f') ? 'f' : 't');
                else if (op == '|') stack.push(expItems.contains('t') ? 't' : 'f');
                else if (op == '!') stack.push(expItems.contains('t') ? 'f' : 't');
            } else if (c != ',') {
                stack.push(c);
            }
        }
        return stack.pop() == 't';
    }
public boolean var_0 ( String var_2 ) {
  Stack < Character > var_5 = new Stack < > ( ) ;
  for ( char var_7 : var_2 . toCharArray ( ) ) {
    if ( var_7 == ')' ) {
      Set < Character > var_11 = new HashSet < > ( ) ;
      while ( var_5 . peek ( ) != '(' ) var_11 . add ( var_5 . pop ( ) ) ;
      var_5 . pop ( ) ;
      char var_16 = var_5 . pop ( ) ;
      if ( var_16 == '&' ) var_5 . push ( var_11 . contains ( 'f' ) ? 'f' : 't' ) ;
      else if ( var_16 == '|' ) var_5 . push ( var_11 . contains ( 't' ) ? 't' : 'f' ) ;
      else if ( var_16 == '!' ) var_5 . push ( var_11 . contains ( 't' ) ? 'f' : 't' ) ;
    }
    else if ( var_7 != ',' ) {
      var_5 . push ( var_7 ) ;
    }
  }
  return var_5 . pop ( ) == 't' ;
}
