100 atcoder#ABC052B. [ABC052B] Increment Decrement

[ABC052B] Increment Decrement

Score : 200200 points

Problem Statement

You have an integer variable xx. Initially, x=0x=0.

Some person gave you a string SS of length NN, and using the string you performed the following operation NN times. In the ii-th operation, you incremented the value of xx by 11 if Si=S_i=I, and decremented the value of xx by 11 if Si=S_i=D.

Find the maximum value taken by xx during the operations (including before the first operation, and after the last operation).

Constraints

  • 1N1001 \leq N \leq 100
  • S=N|S|=N
  • No characters except I and D occur in SS.

Input

The input is given from Standard Input in the following format:

NN

SS

Output

Print the maximum value taken by xx during the operations.

5
IIDID
2

After each operation, the value of xx becomes 11, 22, 11, 22 and 11, respectively. Thus, the output should be 22, the maximum value.

7
DDIDDII
0

The initial value x=0x=0 is the maximum value taken by xx, thus the output should be 00.