aaaaabb
 aabaaaa
 babbabaabbbbabwbvbhbbbaaabbabbbbbbbkabbbbabaaabbbbbbajabbaaabazbbbzbalbabbwbbaabbabacabdbabbbfaaabbb
 baaahbbbba
 ababavvvv
 abnxabbaab
 krflnzhter
 amaabbbbxaabbbabaabaabbaaabaaaaabibbabaabaaabaabcaaxabablbbbbmbbbaaaaaabbaabbbaaabaaaababaababbabbbb
 babbbaaaaaabbbaabaaaaaoaabababaababaaaaababaaaaaaabbbbbbaaapaabaaabaaababaaaabaaaabaaaaababaaaabaaab

5
 14
 42467327
 7
 7
 11
 0
 98718509
 813881762


s = input()

partitions = []

a = 0

for c in s:
    if (c == 'a'):
        a += 1
    if (c == 'b' and a > 0):
        partitions.append(a)
        a = 0

if (a > 0):
    partitions.append(a)

    
combinations = 1

for a in partitions:
    combinations *= (a + 1)

combinations -= 1

print(combinations)
