Peak Occupancy
A log records cars entering (I) and leaving (O) an initially empty car park (the log is consistent). Print the maximum number of cars present at once.
Input: the first line has N; the second line has the N events separated by spaces.
Output: the peak occupancy.
Constraints:
- 1 ≤ N ≤ 105
Sample Tests
Input 1
6 I I O I I O
Output 1
3
Input 2
1 I
Output 2
1
Discussion (opens after you solve — no spoilers before)
No comments yet.