Skip to content

Commit ebcf502

Browse files
committed
atcoder/abc052B
1 parent 234951b commit ebcf502

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

atcoder/abc052/B/main.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#include <bits/stdc++.h>
2+
3+
using namespace std;
4+
using ll = long long;
5+
6+
int main() {
7+
ios_base::sync_with_stdio(false);
8+
cin.tie(0); cout.tie(0);
9+
10+
int N;
11+
string S;
12+
cin >> N >> S;
13+
14+
int maxx = 0;
15+
int x = 0;
16+
for (auto ch : S) {
17+
if (ch == 'I') ++x;
18+
if (ch == 'D') --x;
19+
maxx = max(maxx, x);
20+
}
21+
cout << maxx << endl;
22+
23+
return 0;
24+
}

0 commit comments

Comments
 (0)