aaaaabb
 aabaaaa
 babbabaabbbbabwbvbhbbbaaabbabbbbbbbkabbbbabaaabbbbbbajabbaaabazbbbzbalbabbwbbaabbabacabdbabbbfaaabbb
 baaahbbbba
 ababavvvv
 abnxabbaab
 krflnzhter
 amaabbbbxaabbbabaabaabbaaabaaaaabibbabaabaaabaabcaaxabablbbbbmbbbaaaaaabbaabbbaaabaaaababaababbabbbb
 babbbaaaaaabbbaabaaaaaoaabababaababaaaaababaaaaaaabbbbbbaaapaabaaabaaababaaaabaaaabaaaaababaaaabaaab

5
 14
 42467327
 7
 7
 11
 0
 98718509
 813881762


import java.util.Scanner;

public class Main {
	static long qz[]=new long[100000+5];
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner ip=new Scanner(System.in);
		String s=ip.nextLine();
		int len=s.length();
		int cnt=0;
		int now=0;
		for(int i=0;i<len;i++){
			if(s.charAt(i)=='a'){
				now++;
			}
			if(s.charAt(i)=='b'){
				qz[cnt]=now;
				cnt++;
				now=0;
			}
		}
		qz[cnt]=now;
		cnt++;
		long ans=1;
		for(int i=0;i<cnt;i++){
			ans=ans*((long) 1+qz[i]);
		}
		System.out.println(ans-1);
	}

}
