aaaaabb
 aabaaaa
 babbabaabbbbabwbvbhbbbaaabbabbbbbbbkabbbbabaaabbbbbbajabbaaabazbbbzbalbabbwbbaabbabacabdbabbbfaaabbb
 baaahbbbba
 ababavvvv
 abnxabbaab
 krflnzhter
 amaabbbbxaabbbabaabaabbaaabaaaaabibbabaabaaabaabcaaxabablbbbbmbbbaaaaaabbaabbbaaabaaaababaababbabbbb
 babbbaaaaaabbbaabaaaaaoaabababaababaaaaababaaaaaaabbbbbbaaapaabaaabaaababaaaabaaaabaaaaababaaaabaaab

5
 14
 42467327
 7
 7
 11
 0
 98718509
 813881762

import java.util.*;
public final class test
{
	
	public static void main(String []args)
	{
		
		Scanner sc = new Scanner(System.in);
		String s = sc.next()+'b';
		int c = 1, p = 1;
		char ch;
		for(int i=0;i<s.length();i++)
		{
			
			ch = s.charAt(i);
			if(ch == 'a')
				c++;
			if(ch == 'b')
			{
				
				p *= c;
				c = 1;
				
			}
			
		}
		System.out.println(--p);
		
	}
	
}