aaaaabb
 aabaaaa
 babbabaabbbbabwbvbhbbbaaabbabbbbbbbkabbbbabaaabbbbbbajabbaaabazbbbzbalbabbwbbaabbabacabdbabbbfaaabbb
 baaahbbbba
 ababavvvv
 abnxabbaab
 krflnzhter
 amaabbbbxaabbbabaabaabbaaabaaaaabibbabaabaaabaabcaaxabablbbbbmbbbaaaaaabbaabbbaaabaaaababaababbabbbb
 babbbaaaaaabbbaabaaaaaoaabababaababaaaaababaaaaaaabbbbbbaaapaabaaabaaababaaaabaaaabaaaaababaaaabaaab

5
 14
 42467327
 7
 7
 11
 0
 98718509
 813881762

import java.io.*;
import java.util.*;
public class SOl
{
    public static void main(String args[])throws IOException
    {
        BufferedReader obj=new BufferedReader(new InputStreamReader(System.in));
        String str=obj.readLine();
        String newstr="";
        for(int i=0;i<str.length();i++)
        {
            if(str.charAt(i)=='a'||str.charAt(i)=='b')
            newstr+=str.charAt(i);
        }
        
        long ans=1;
        long chunksize=0;
        for(int i=0;i<=newstr.length();i++)
        {
            if(i==newstr.length()||newstr.charAt(i)!='a')
            {
                ans*=(chunksize+1);
                chunksize=0;
            }
            else
            if(newstr.charAt(i)=='a')
            chunksize++;
             
        }
        System.out.println(ans-1);
    }
}