Skip to content

Commit 120503f

Browse files
committed
Create AGC_034_B.cpp
#19
1 parent 7c00dfb commit 120503f

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

AGC_034_B.cpp

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#include <iostream>
2+
#include <string>
3+
using namespace std;
4+
5+
int main() {
6+
string s;
7+
cin >> s;
8+
9+
// dummy
10+
s += "F";
11+
12+
long long ans = 0;
13+
long long aCount = 0;
14+
15+
for (int i = 0; i < s.length(); i++)
16+
{
17+
if (s[i] == 'A')
18+
{
19+
aCount++;
20+
}
21+
else if (s.substr(i, 2) == "BC")
22+
{
23+
ans += aCount;
24+
i++;
25+
}
26+
else
27+
{
28+
aCount = 0;
29+
}
30+
}
31+
32+
cout << ans << endl;
33+
}

0 commit comments

Comments
 (0)