Score : $600$ points
You are given a string $s$ consisting of A
, B
and C
.
Snuke wants to perform the following operation on $s$ as many times as possible:
ABC
and replace it with BCA
.Find the maximum possible number of operations.
A
, B
and C
.Input is given from Standard Input in the following format:
$s$
Find the maximum possible number of operations.
ABCABC
3
You can perform the operations three times as follows: ABCABC
→ BCAABC
→ BCABCA
→ BCBCAA
. This is the maximum result.
C
0
ABCACCBABCBCAABCB
6