output_description: Find the maximum possible number of operations.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      s
attempt: t = input().replace("ABC", "T")
  s = t.replace("BC", "Z")
  l = []
  flagA = False
  cntA = 0
  cnt = 0
  count = 0
  flag = False
  comb = False
  cmcnt = 0
  tmp = 0
  # print(s)
  for i in range(len(s)):
  
      if s[i] == "T":
          if comb:
              cmcnt = 1
          count += 1
          flag = True
          if flagA:
              flagA = False
              cntA = tmp
          continue
  
      if flag:
          if s[i] == "Z":
              cnt += 1
          else:
              l.append([cmcnt, cntA, count, cnt])
              comb = True
              flag = False
              flagA = False
              cnt = 0
              count = 0
              cntA = 0
              if s[i] == "A":
                  tmp += 1
                  flagA = True
      else:
          if s[i] == "A":
              tmp += 1
              flagA = True
          else:
              tmp = 0
              comb = False
  ans = 0
  if count > 0:
      l.append([cmcnt, cntA, count, cnt])
  # print(l)
  for i in range(len(l)):
      ans += l[i][0]
      ans += l[i][1]
      ans += (l[i][2] * (l[i][2] + 1)) // 2
      ans += l[i][3]
  print(ans)
  
problem_description: Statement
  
  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:
  
    * Choose a contiguous substring of s that reads `ABC` and replace it with `BCA`.
  
  Find the maximum possible number of operations.
samples: [{"input": "ABCABC", "output": "3\n    \n\nYou can perform the operations three times as follows: `ABCABC` \u2192 `BCAABC` \u2192\n`BCABCA` \u2192 `BCBCAA`. This is the maximum result.\n\n* * *"}, {"input": "C", "output": "0\n    \n\n* * *"}, {"input": "ABCACCBABCBCAABCB", "output": "6"}]