C++ Define a function unbalanced brackets that takes in a string and returns the number of unbalanced brackets. In other words, returns the difference of open and closed curly brackets. int unbalanced brackets(string input); Example Enter a string: { }}} Output -2 Explanation 1 open - 3 closed = -2 Enter a string: {{{}{}}{} Output 1 Explanation 5 open - 4 closed = 1.
C++ Define a function unbalanced brackets that takes in a string and returns the number of unbalanced brackets. In other words, returns the difference of open and closed curly brackets. int unbalanced brackets(string input); Example Enter a string: { }}} Output -2 Explanation 1 open - 3 closed = -2 Enter a string: {{{}{}}{} Output 1 Explanation 5 open - 4 closed = 1.