#include <bits/stdc++.h>
using namespace std;
template <typename A, typename B>
inline void chmin(A &a, B b) {
  if (a > b) a = b;
}
template <typename A, typename B>
inline void chmax(A &a, B b) {
  if (a < b) a = b;
}
const long long mod = 1000000007;
inline void add(long long &a, long long b) {
  a += b;
  if (a >= mod) a -= mod;
}
string S;
long long m[111111];
long long dp[111111];
signed main() {
  cin >> S;
  for (long long i = 0; i < (S.size()); i++) {
    if (S[i] == 'a')
      m[i + 1] = (m[i] + 1) % 3;
    else
      m[i + 1] = (m[i] + 2) % 3;
  }
  dp[0] = 1;
  queue<long long> que[3];
  for (long long i = 0; i < (S.size()); i++) que[m[i + 1]].push(i + 1);
  for (long long i = 0; i < (S.size()); i++) {
    for (long long j = 1; j <= 2; j++) {
      if (que[(m[i] + j) % 3].size() == 0) continue;
      long long k = que[(m[i] + j) % 3].front();
      add(dp[k], dp[i]);
    }
    que[m[i + 1]].pop();
  }
  long long ans = 0;
  for (long long i = 1; i <= S.size(); i++) {
    if (m[i] == m[S.size()]) add(ans, dp[i]);
  }
  cout << ans << endl;
  return 0;
}
