#include <bits/stdc++.h>
#pragma GCC optimize(2)
#pragma G++ optimize(2)
using namespace std;
char nc() { return getchar(); }
int read() {
  int x = 0, y = 1;
  char c = nc();
  while (!isdigit(c)) {
    if (c == '-') y = -1;
    c = nc();
  }
  while (isdigit(c)) {
    x = (x << 1) + (x << 3) + (c ^ 48);
    c = nc();
  }
  return x * y;
}
int n, lst[3], sm[100005];
char s[100005];
long long f[100005];
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  bool flag = false;
  for (int i = 1; i <= n; i++) {
    if (i > 1 && s[i] == s[i - 1]) flag = true;
    sm[i] = (sm[i - 1] + (s[i] - 96)) % 3;
  }
  if (!flag) return puts("0"), 0;
  for (int i = 1; i <= n; i++) {
    f[i] =
        (f[lst[(sm[i] + 1) % 3]] + f[lst[(sm[i] + 2) % 3]] + (sm[i] ? 1 : 0)) %
        1000000007;
    lst[sm[i]] = i;
  }
  printf("%lld", f[n]);
  return 0;
}
