100 atcoder#ABC052B. [ABC052B] Increment Decrement
[ABC052B] Increment Decrement
Score : points
Problem Statement
You have an integer variable . Initially, .
Some person gave you a string of length , and using the string you performed the following operation times.
In the -th operation, you incremented the value of by if I
, and decremented the value of by if D
.
Find the maximum value taken by during the operations (including before the first operation, and after the last operation).
Constraints
- No characters except
I
andD
occur in .
Input
The input is given from Standard Input in the following format:
Output
Print the maximum value taken by during the operations.
5
IIDID
2
After each operation, the value of becomes , , , and , respectively. Thus, the output should be , the maximum value.
7
DDIDDII
0
The initial value is the maximum value taken by , thus the output should be .