#include <bits/stdc++.h>
using namespace std;
int n, ap[17][100100], t[100100], pr[100100], f[100100], a[100100];
char s[100100];
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  for (int i = 2; i <= n; ++i) t[i] = t[i - 1] + (s[i] == s[i - 1]);
  for (int i = 1; i <= n; ++i) {
    pr[i] = (pr[i - 1] + (a[i] = s[i] - 96)) % 3;
    ap[0][i] = 1 << pr[i];
  }
  for (int j = 1; j <= 16; ++j)
    for (int i = 1, _E_ = n + 1 - (1 << j); i <= _E_; ++i)
      ap[j][i] = ap[j - 1][i] | ap[j - 1][i + (1 << j - 1)];
  f[0] = 1;
  for (int i = 0; i < n; ++i) {
    f[i + 1] = (f[i + 1] + f[i]) % 1000000007;
    int l = i + 1, r = n, m, s = n + 1;
    while (l <= r)
      if (t[m = l + r >> 1] != t[i + 1])
        r = m - 1, s = m;
      else
        l = m + 1;
    if (s > n) continue;
    for (int j = 16; j + 1; --j)
      if (s + (1 << j) <= n + 1 &&
          !(ap[j][s] & 1 << (3 + pr[i] - a[i + 1]) % 3))
        s += 1 << j;
    if (s > n) continue;
    f[s] = (f[s] + f[i]) % 1000000007;
  }
  int ans = f[n];
  for (int i = n - 1; i; --i)
    if (pr[n] == pr[i]) ans = (ans + f[i]) % 1000000007;
  printf("%d", ans);
}
