Олимпиадный тренинг

Задача 38522. Decrease-enlarge


Задача

Темы: Строки Циклы
You have an integer variable x. Initially \(x = 0\). Someone gave you a string S of length N, and using that string you performed the following operation N times. In the ith operation, you incremented x by 1 if Si = I, and decrement x by 1 if Si = D. Find the maximum value x takes during operations (including before the first operation and after the last operation).

Input
The first line contains the number (\(1<=N<=100\)), the second line contains the string S . The length of the N string. The string contains only the characters and D.

Imprint
Print the maximum x value obtained during the operations.
 

 

Examples
# Input Output
1
5
IDID
2
2
7
DDIDDII
0