aaaaabb
 aabaaaa
 babbabaabbbbabwbvbhbbbaaabbabbbbbbbkabbbbabaaabbbbbbajabbaaabazbbbzbalbabbwbbaabbabacabdbabbbfaaabbb
 baaahbbbba
 ababavvvv
 abnxabbaab
 krflnzhter
 amaabbbbxaabbbabaabaabbaaabaaaaabibbabaabaaabaabcaaxabablbbbbmbbbaaaaaabbaabbbaaabaaaababaababbabbbb
 babbbaaaaaabbbaabaaaaaoaabababaababaaaaababaaaaaaabbbbbbaaapaabaaabaaababaaaabaaaabaaaaababaaaabaaab

5
 14
 42467327
 7
 7
 11
 0
 98718509
 813881762

s_ = input().strip()
s = ""

for i in s_:
	if i == "a" or i == "b":
		s += i

a_s = []
i = 0
temp = ""
while i < len(s):
	if s[i] == "a":
		temp += s[i]
	else:
		a_s.append(temp)
		temp = ""
	i+=1
a_s.append(temp)

# print(a_s)
prod = 1
for a in a_s:
	prod *= len(a)+1

print(prod-1)