aaaaabb
 aabaaaa
 babbabaabbbbabwbvbhbbbaaabbabbbbbbbkabbbbabaaabbbbbbajabbaaabazbbbzbalbabbwbbaabbabacabdbabbbfaaabbb
 baaahbbbba
 ababavvvv
 abnxabbaab
 krflnzhter
 amaabbbbxaabbbabaabaabbaaabaaaaabibbabaabaaabaabcaaxabablbbbbmbbbaaaaaabbaabbbaaabaaaababaababbabbbb
 babbbaaaaaabbbaabaaaaaoaabababaababaaaaababaaaaaaabbbbbbaaapaabaaabaaababaaaabaaaabaaaaababaaaabaaab

5
 14
 42467327
 7
 7
 11
 0
 98718509
 813881762

import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String pattern = scan.next();
        ArrayList<Integer> bucket = new ArrayList<>();
        int countA = 0;
        for (char ch: pattern.toCharArray()){
            if (ch == 'a')
                countA++;
            if (ch == 'b'){
                countA++;
                bucket.add(countA);
                countA = 0;
            }
        }
        countA++;
        bucket.add(countA);
        int product = 1;
        for (int x: bucket){
            product *= x;
            //System.out.println(x);
        }
        product--;
        System.out.println(product);
    }
}