#include <bits/stdc++.h>
char s[100001];
long long n, g, a[100001], pre[100001], nxt[100001][3], f[100001], ans;
int main() {
  scanf("%s", s + 1);
  while (s[n + 1]) n++;
  for (long long i = 1; i <= n; i++) pre[i] = pre[i - 1] + (a[i] = s[i] - '`');
  for (long long i = 1; i <= n - 1; i++)
    if (a[i] == a[i - 1]) g = 1;
  if (!g) {
    printf("%lld", (1 + (long long)(1e9 + 7)) % (long long)(1e9 + 7));
    return 0;
  }
  for (long long i = n - 1; i >= 0; i--)
    for (long long o = 1; o <= 2; o++)
      nxt[i][(pre[i] + o) % 3] =
          a[i + 1] == o ? i + 1 : nxt[i + 1][(pre[i] + o) % 3];
  f[0] = 1;
  for (long long i = 0; i <= n - 1; i++)
    for (long long o = 1; o <= 2; o++)
      (f[nxt[i][(pre[i] + o) % 3]] += f[i]) %= (long long)(1e9 + 7);
  for (long long i = 1; i <= n; i++)
    if ((pre[n] - pre[i]) % 3 == 0) (ans += f[i]) %= (long long)(1e9 + 7);
  printf("%lld", (ans + (long long)(1e9 + 7)) % (long long)(1e9 + 7));
}
