Easy Python solution+ comments (12ms , 99% faster)
\nclass Solution(object):\n    def minAddToMakeValid(self, S):\n        """\n        :type S: str\n        :rtype: int\n        """\n        stack =[]\n        
```\nclass Solution(object):\n    def minAddToMakeValid(self, S):\n        """\n        :type S: str\n        :rtype: int\n        """\n        stack =[]\n        \n        for i in range(len(S)):\n            \n            # if character is "(", then append to the stack\n            if S[i] == "(":\n                stack.append(S[i])\n            else:\n                if S[i] == ")":\n                    \n                    # check if stack has a character and also if the character is "(", then pop the character\n                    if stack and stack[-1] == \'(\':\n                        stack.pop()\n                        \n                    # else append ")" into the stack\n                    else:\n                        stack.append(S[i])\n                        \n        # At the end return the length of the stack    \n        return len(stack)\n```
['Python']