Find Maximum Depth of Nested Parentheses

Write an anonymous function that returns the maximum depth of nested parentheses in a string. If the opening and closing parentheses do not match, return the error message "Error: Unmatched opening parentheses." for unmatched opening parentheses and "Error: Unmatched closing parentheses." for unmatched closing parentheses.
        
       Input:-((())())
       Input Description: Input a string containing parentheses. 
       Output: 3
       Output Description: Output the maximum depth. 
       Constraints: 1 <= string length <= 10^6
       Explanation: 

Loading...