Our best explorer, Vingying, finds a deep cave that is full of diamonds! Well, he is a very careful man, so he decides to do some research before collecting them.
The diamonds can be divided into three kinds, noted as $$$\text{A,B,C}$$$ for convenience. There are a total of $$$n$$$ diamonds in a row, which can be regarded as a sequence $$$s_1,s_2,\dots,s_n$$$ from left to right. Vingying will perform the operation several times, which consists of the following three steps in order.
For example, $$$s=\text{ABCABC}$$$. We can choose index $$$1$$$ and collect $$$1,3$$$, then $$$s$$$ becomes $$$\text{BABC}$$$ indexed $$$1,2,3,4$$$. But if we choose index $$$4$$$ and collect $$$5$$$, then $$$s$$$ becomes $$$\text{ABCAC}$$$ indexed $$$1,2,3,4,5$$$.
Vingying wants to know the maximum number of operations (not the diamonds) he can do.
The input contains a string consisting of only $$$\text{A,B,C}$$$ representing the sequence of the diamonds. The length of the string won't exceed $$$2\times10^5$$$.
Output a single integer representing the maximum number of operations.
ABCAAABCCC
2
AABCAAABCCC
4
| Name |
|---|


