aaaaabb
 aabaaaa
 babbabaabbbbabwbvbhbbbaaabbabbbbbbbkabbbbabaaabbbbbbajabbaaabazbbbzbalbabbwbbaabbabacabdbabbbfaaabbb
 baaahbbbba
 ababavvvv
 abnxabbaab
 krflnzhter
 amaabbbbxaabbbabaabaabbaaabaaaaabibbabaabaaabaabcaaxabablbbbbmbbbaaaaaabbaabbbaaabaaaababaababbabbbb
 babbbaaaaaabbbaabaaaaaoaabababaababaaaaababaaaaaaabbbbbbaaapaabaaabaaababaaaabaaaabaaaaababaaaabaaab

5
 14
 42467327
 7
 7
 11
 0
 98718509
 813881762

def _1084C():
    s = input()
    res = []
    count = 0
    for i in s:
        if i == 'b':
            res.append(count)
            count = 0
        elif i == 'a':
            count += 1
    res.append(count)
    ans = 1
    for i in res:
        if i:
            ans *= (i+1)
    print(ans-1)

if __name__ == '__main__':
    _1084C()