aaaaabb
 aabaaaa
 babbabaabbbbabwbvbhbbbaaabbabbbbbbbkabbbbabaaabbbbbbajabbaaabazbbbzbalbabbwbbaabbabacabdbabbbfaaabbb
 baaahbbbba
 ababavvvv
 abnxabbaab
 krflnzhter
 amaabbbbxaabbbabaabaabbaaabaaaaabibbabaabaaabaabcaaxabablbbbbmbbbaaaaaabbaabbbaaabaaaababaababbabbbb
 babbbaaaaaabbbaabaaaaaoaabababaababaaaaababaaaaaaabbbbbbaaapaabaaabaaababaaaabaaaabaaaaababaaaabaaab

5
 14
 42467327
 7
 7
 11
 0
 98718509
 813881762

s=input()
a=[]
b=0
for i in range(0,len(s)):
    if(s[i]=="a" or s[i]=="b"):
        a.append(s[i])
        if(s[i]=="b"):
            b+=1
if(len(a)==0 or b==len(a)):
    print(0)
else:
    blocks=[]
    i=0
    while(i<len(a)):
        if(a[i]=="a"):
            m=1
            i+=1
            while(i<len(a)):
                if(a[i]=="a"):
                    m+=1
                    i+=1
                else:
                    break
            blocks.append(m)
        else:
            i+=1
    ans=1
    for i in range(0,len(blocks)):
        ans=ans*(blocks[i]+1)
    print(ans-1)
        



