#K58322. Maximum Parentheses Depth
Maximum Parentheses Depth
Maximum Parentheses Depth
Given a mathematical expression containing digits, operators ('+', '-', '*', '/') and parentheses, determine the maximum depth of nested parentheses in the expression.
The nesting depth is defined as the maximum number of open parentheses at any point when scanning the expression from left to right. For example, in the expression ((1+2)*3)+((4/2)+(5+(6-7)))
, the maximum depth is 3.
Note: The expression may be unbalanced. In such cases, consider only the maximum nesting achieved during the scan.
inputFormat
The input consists of a single line containing a mathematical expression. This expression may include digits, the operators '+', '-', '*', '/', and parentheses '('.
Input is provided via standard input (stdin).
outputFormat
Output a single integer representing the maximum depth of nested parentheses found in the given expression. The result should be printed to standard output (stdout).
## sample1+2-3*4/5
0