aaaaabb
 aabaaaa
 babbabaabbbbabwbvbhbbbaaabbabbbbbbbkabbbbabaaabbbbbbajabbaaabazbbbzbalbabbwbbaabbabacabdbabbbfaaabbb
 baaahbbbba
 ababavvvv
 abnxabbaab
 krflnzhter
 amaabbbbxaabbbabaabaabbaaabaaaaabibbabaabaaabaabcaaxabablbbbbmbbbaaaaaabbaabbbaaabaaaababaababbabbbb
 babbbaaaaaabbbaabaaaaaoaabababaababaaaaababaaaaaaabbbbbbaaapaabaaabaaababaaaabaaaabaaaaababaaaabaaab

5
 14
 42467327
 7
 7
 11
 0
 98718509
 813881762

from __future__ import print_function # for PyPy2
from collections import Counter, OrderedDict
from itertools import permutations as perm
from collections import deque
from sys import stdin
from bisect import *
from heapq import *
import math
 
g   = lambda : stdin.readline().strip()
gl  = lambda : g().split()
gil = lambda : [int(var) for var in gl()]
gfl = lambda : [float(var) for var in gl()]
gcl = lambda : list(g())
gbs = lambda : [int(var) for var in g()]
mod = int(1e9)+7
inf = float("inf")

def productOfSubsetSums(arr):

    ans = 1;n=len(arr) 
    for i in range(0,n): 
        ans = ans * (arr[i] + 1) 
    return ans-1



s = g()
ans = s.count("a")
cnt = s.count("b")
if cnt:
	i = 0
	arr = []
	s += "b"
	n = len(s)
	while i < n:
		while i < n and s[i] !="a":
			i += 1
		ct = 0
		while i < n and s[i] != "b":
			if s[i] == "a": ct += 1
			i += 1

		if ct : arr.append(ct)

	print(productOfSubsetSums(arr))
else :
	print(ans)