#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
int n, nxt[100005];
char s[100005];
long long f[100005], ans;
int main() {
  scanf("%s", s + 1);
  n = (int)strlen(s + 1);
  nxt[n] = n + 1;
  for (int i = n; i >= 1; i--) nxt[i - 1] = s[i] == s[i + 1] ? i + 1 : nxt[i];
  f[0] = 1;
  for (int i = 0; i <= n; i++) {
    f[i] %= MOD;
    f[i + 1] += f[i];
    f[nxt[i]] += f[i];
  }
  int now = 0;
  bool flag = 0;
  for (int i = n; i >= 0; i--) {
    flag |= s[i] == s[i + 1];
    if ((now && flag) || i == n - 1) ans += f[i];
    now = (now + s[i] - 'a' + 1) % 3;
  }
  printf("%lld\n", ans % MOD);
  return 0;
}
