aaaaabb
 aabaaaa
 babbabaabbbbabwbvbhbbbaaabbabbbbbbbkabbbbabaaabbbbbbajabbaaabazbbbzbalbabbwbbaabbabacabdbabbbfaaabbb
 baaahbbbba
 ababavvvv
 abnxabbaab
 krflnzhter
 amaabbbbxaabbbabaabaabbaaabaaaaabibbabaabaaabaabcaaxabablbbbbmbbbaaaaaabbaabbbaaabaaaababaababbabbbb
 babbbaaaaaabbbaabaaaaaoaabababaababaaaaababaaaaaaabbbbbbaaapaabaaabaaababaaaabaaaabaaaaababaaaabaaab

5
 14
 42467327
 7
 7
 11
 0
 98718509
 813881762

import java.util.Scanner;
public class Blits {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String s = "", q = scan.nextLine();
        char arr[] = q.toCharArray();
        for (char i : arr) if (i == 'a' || i == 'b') s += i;
        arr = s.toCharArray();
        long ans = 1;
        int cnt = 0;
        for (char i : arr){
            if (i == 'a') cnt++;
            if (i == 'b') {ans *= (cnt + 1); cnt = 0;}
        }
        ans *= (cnt + 1);
        ans--;
        System.out.println(ans);
    }
}
