<awangdev>921. Minimum Add to Make Parentheses Valid_1.java
public int minAddToMakeValid(String s) {
        if (s == null || s.length() == 0) {
            return 0;
        }
        Stack<Character> stack = new Stack<>();
        int count = 0;
        for (char c : s.toCharArray()) {
            if (c == '(') stack.push(c);
            else if (stack.isEmpty()) count++;
            else stack.pop();
        }
        return count + stack.size();
    }
public int sample_funcname ( String var_1 ) {
  if ( var_1 == null || var_1 . length ( ) == 0 ) {
    return 0 ;
  }
  Stack < Character > var_7 = new Stack < > ( ) ;
  int var_8 = 0 ;
  for ( char var_10 : var_1 . toCharArray ( ) ) {
    if ( var_10 == '(' ) var_7 . push ( var_10 ) ;
    else if ( var_7 . isEmpty ( ) ) var_8 ++ ;
    else var_7 . pop ( ) ;
  }
  return var_8 + var_7 . size ( ) ;
}
