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 mod = 1000000007;
int m_inf = INT_MIN;
int main() {
  string s;
  cin >> s;
  int n = s.length();
  string str = "";
  for (int i = 0; i < n; i++) {
    if (s[i] == 'a' || s[i] == 'b') str += s[i];
  }
  vector<long long int> v;
  long long int cnt = 0;
  for (int i = 0; i < str.length(); i++) {
    if (str[i] == 'a') {
      cnt = 0;
      while (i < n && str[i] == 'a') {
        cnt++;
        i++;
      }
      v.push_back(cnt);
      i--;
    }
  }
  long long int ans = 1;
  for (int i = 0; i < v.size(); i++) {
    ans = ans * (v[i] + 1);
  }
  cout << ans - 1LL;
}
