f = open('D:/47021.txt')
Lline, Gline = 0, 0
minn = 0
flag = 0
tmp = []
f1 = f.readline()
s = f1.split('A')
for i in s:
    if len(i) >=8  and 'B' not in i:
        tmp.append(i)
        print(i)
print(len(tmp))