#K66922. Maximum Nesting Depth of Folding Regions

    ID: 32528 Type: Default 1000ms 256MiB

Maximum Nesting Depth of Folding Regions

Maximum Nesting Depth of Folding Regions

Given a line of code that may contain folding regions delimited by /* and */, compute the maximum nesting depth of these folding regions.

A folding region starts with /* and ends with */. Nested regions are allowed, and each properly nested /* increases the current depth by 1, while each corresponding */ decreases it. Your task is to determine the deepest level of nesting.

Formally, if we denote the start and end symbols as \(\text{/*}\) and \(\text{*/}\) respectively, then the maximum nesting depth is the maximum value of the counter while scanning the string from left to right.

inputFormat

The input consists of two lines:

  1. The first line contains an integer \(T\) which represents the length of the code line.
  2. The second line contains a string of length \(T\) representing the code with possible folding regions.

outputFormat

Output a single integer representing the maximum nesting depth of the folding regions in the provided code line.

## sample
24
int main() { // code }
0