<doocs>0921.Minimum Add to Make Parentheses Valid_1.py
def minAddToMakeValid( s: str) -> int:
    stk = []
    for c in s:
        if c == '(':
            stk.append(c)
        else:
            if stk and stk[-1] == '(':
                stk.pop()
            else:
                stk.append(c)
    return len(stk)
def sample_funcname ( var_0 : str ) -> int :
    var_3 = [ ]
    for var_4 in var_0 :
        if var_4 == '(' :
            var_3.append ( var_4 )
        else :
            if var_3 and var_3 [ - 1 ] == '(' :
                var_3.pop ( )
            else :
                var_3.append ( var_4 )
    return len ( var_3 )
