#include <bits/stdc++.h>
using namespace std;
char str[100005];
int ta[100005], tb[100005];
long long int dp[100005];
bool oka[100005];
bool okb[100005];
int main() {
  scanf("%s", &str);
  int n = strlen(str);
  ta[n] = tb[n] = -1;
  oka[n] = okb[n] = true;
  for (int i = n - 1; i >= 0; i--) {
    if (str[i] == 'a') {
      ta[i] = i + 1;
      tb[i] = ta[i + 1];
    } else {
      ta[i] = tb[i + 1];
      tb[i] = i + 1;
    }
    oka[i] = okb[i] = false;
    if (ta[i] != -1 && tb[ta[i]] != -1) oka[i] = oka[tb[ta[i]]];
    if (tb[i] != -1 && ta[tb[i]] != -1) okb[i] = okb[ta[tb[i]]];
  }
  dp[0] = 1;
  long long int ret = 0;
  for (int i = 0; i < n; i++) {
    if (ta[i] != -1) {
      if (oka[ta[i]] || okb[ta[i]]) {
        ret += dp[i];
        if (ret >= 1000000007) ret -= 1000000007;
      }
      dp[ta[i]] += dp[i];
      if (dp[ta[i]] >= 1000000007) dp[ta[i]] -= 1000000007;
    }
    if (tb[i] != -1) {
      if (okb[tb[i]] || oka[tb[i]]) {
        ret += dp[i];
        if (ret >= 1000000007) ret -= 1000000007;
      }
      dp[tb[i]] += dp[i];
      if (dp[tb[i]] >= 1000000007) dp[tb[i]] -= 1000000007;
    }
  }
  printf("%lld\n", ret);
  return 0;
}
