{"raw_statement":[{"iden":"problem statement","content":"You are given a string $s$ consisting of `A`, `B` and `C`.\nSnuke wants to perform the following operation on $s$ as many times as possible:\n\n*   Choose a contiguous substring of $s$ that reads `ABC` and replace it with `BCA`.\n\nFind the maximum possible number of operations."},{"iden":"constraints","content":"*   $1 \\leq |s| \\leq 200000$\n*   Each character of $s$ is `A`, `B` and `C`."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$s$"},{"iden":"sample input 1","content":"ABCABC"},{"iden":"sample output 1","content":"3\n\nYou can perform the operations three times as follows: `ABCABC` → `BCAABC` → `BCABCA` → `BCBCAA`. This is the maximum result."},{"iden":"sample input 2","content":"C"},{"iden":"sample output 2","content":"0"},{"iden":"sample input 3","content":"ABCACCBABCBCAABCB"},{"iden":"sample output 3","content":"6"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}