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;
using ll = long long;
void solve() {
  int n;
  string s;
  cin >> s;
  n = s.length();
  int len = 0;
  ll ans = 1;
  for (int i = 0; i < n; i++) {
    if (s[i] != 'a' && s[i] != 'b') continue;
    if (s[i] == 'a')
      len++;
    else {
      ans *= (len + 1);
      len = 0;
    }
  }
  ans *= (len + 1);
  cout << ans - 1 << endl;
}
int main() {
  solve();
  return 0;
}
