from sys import stdin
s = stdin.readline().rstrip()
s = s.replace("BC","D")
point = 0
count = 0
for i in s:
    if i == "A":
        count += 1
    elif i == "D":
        point += count
    else:
        count = 0
print(point) from sys import stdin s = stdin.readline().rstrip() s stdin.readline().rstrip() stdin.readline().rstrip stdin.readline() stdin.readline stdin readline rstrip s = s.replace("BC","D") s s.replace("BC","D") s.replace s replace "BC" "D" point = 0 point 0 count = 0 count 0 for i in s:
    if i == "A":
        count += 1
    elif i == "D":
        point += count
    else:
        count = 0 i s if i == "A":
        count += 1
    elif i == "D":
        point += count
    else:
        count = 0 i == "A" i "A" count += 1 count 1 elif i == "D":
        point += count
     i == "D" i "D" point += count point count count = 0 count 0 print(point) print point count = 0 0 count count += 1 1 count point += count count point point = 0 0 point s = stdin.readline().rstrip() stdin.readline().rstrip() s s = s.replace("BC","D") s.replace("BC","D") s count = 0 0 count
from sys import stdin
s = stdin.readline().rstrip()
s = s.replace("BC","D")
point = 0
count = 0
for i in s:
    if i == "A":
        count += 1
    elif i == "D":
        point += count
    else:
        count = 0
print(point)