aaaaabb
 aabaaaa
 babbabaabbbbabwbvbhbbbaaabbabbbbbbbkabbbbabaaabbbbbbajabbaaabazbbbzbalbabbwbbaabbabacabdbabbbfaaabbb
 baaahbbbba
 ababavvvv
 abnxabbaab
 krflnzhter
 amaabbbbxaabbbabaabaabbaaabaaaaabibbabaabaaabaabcaaxabablbbbbmbbbaaaaaabbaabbbaaabaaaababaababbabbbb
 babbbaaaaaabbbaabaaaaaoaabababaababaaaaababaaaaaaabbbbbbaaapaabaaabaaababaaaabaaaabaaaaababaaaabaaab

5
 14
 42467327
 7
 7
 11
 0
 98718509
 813881762

#include <bits/stdc++.h>
using namespace std;
int main() {
  string str;
  cin >> str;
  long long ctr = 0;
  vector<long long> v;
  for (long long i = 0; i < str.length(); i++) {
    if (str[i] == 'a') {
      ctr++;
    } else if (str[i] == 'b') {
      if (ctr != 0) v.push_back(ctr);
      ctr = 0;
    }
  }
  v.push_back(ctr);
  long long mul = 1;
  for (long long i = 0; i < v.size(); i++) {
    mul *= (v[i] + 1);
  }
  cout << mul - 1;
}
