#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char c = getchar();
  for (; !isdigit(c); c = getchar())
    if (c == '-') f = -1;
  for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
  return x * f;
}
const int MAXN = 100010;
const int INF = 2147483600;
int nxt[MAXN + 1][3];
long long f[MAXN + 1];
char str[MAXN + 1];
int a[MAXN + 1];
long long sum;
inline int Tns(int x) { return (x == 2 ? 1 : 2); }
int N;
const int Mod = 1000000007LL;
int main() {
  scanf("%s", str + 1);
  f[0] = 1;
  N = strlen(str + 1);
  for (int i = 1; i <= N; i++) a[i] = (int)(str[i] - 'a') + 1;
  for (int i = N; i >= 1; i--) {
    nxt[i][1] = nxt[i + 1][(1 - a[i] + 3) % 3];
    nxt[i][2] = nxt[i + 1][(2 - a[i] + 3) % 3];
    nxt[i][0] = nxt[i + 1][(3 - a[i]) % 3];
    nxt[i][a[i]] = i;
  }
  for (int i = 1; i <= N; i++) {
    (f[i] += f[i - 1]) %= Mod;
    if (nxt[i][Tns(a[i])]) (f[nxt[i][Tns(a[i])]] += f[i - 1]) %= Mod;
  }
  long long ans = 0;
  for (int i = N; i >= 1; i--) {
    if (!(sum % 3)) (ans += f[i]) %= Mod;
    sum += a[i];
  }
  printf("%lld\n", ans);
  return 0;
}
