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;
long long int visit[100001] = {0};
vector<long long int> adj[1000001];
long long int coun = 0;
void dfs(long long int node) {
  visit[node] = 1;
  coun++;
  for (long long int i = 0; i < adj[node].size(); i++) {
    if (visit[adj[node][i]] == 0) {
      dfs(adj[node][i]);
    }
  }
}
bool sortinrev(const pair<long long int, long long int> &a,
               const pair<long long int, long long int> &b) {
  if (a.first != b.first)
    return (a.first > b.first);
  else
    return (a.second < b.second);
}
long long int power(long long int x, long long int n, long long int m) {
  long long int result = 1;
  while (n > 0) {
    if (n % 2 == 1) result = (result * x) % m;
    x = (x * x) % m;
    n = n / 2;
  }
  return result % m;
}
bool isPrime(long long int k) {
  if (k <= 1) {
    return false;
  }
  if (k == 2) {
    return true;
  }
  if (k % 2 == 0) {
    return false;
  }
  long long int i = 3;
  while (i * i <= k) {
    if (k % i == 0) {
      return false;
    }
    i += 2;
  }
  return true;
}
long long int bin(long long int n) {
  int di = 0;
  while (n) {
    di = di + n % 10;
    n = n / 10;
  }
  return di;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int t;
  t = 1;
  while (t--) {
    string s;
    cin >> s;
    long long int n = s.length();
    vector<long long int> ans;
    long long int x = 0;
    char c = '1';
    int j = 0;
    long long int y = 0;
    for (long long int i = 0; i < n; i++) {
      if (s[i] == 'a') {
        j = i;
        break;
      }
    }
    for (long long int i = j; i < n; i++) {
      if (s[i] == 'a') {
        x++;
      } else if (s[i] == 'b') {
        if (x != 0) ans.push_back(x);
        x = 0;
      } else
        continue;
    }
    if (x != 0) ans.push_back(x);
    long long int res = 1;
    for (long long int i = 0; i < ans.size(); i++) {
      res = res * (ans[i] + 1);
    }
    cout << res - 1 << "\n";
  }
  return 0;
}
