#include <bits/stdc++.h>
using namespace std;
const int Max_N(100050);
const int MOD(1000000000 + 7);
constexpr int Add(int a, int b) { return a + b >= MOD ? a + b - MOD : a + b; }
constexpr int Sub(int a, int b) { return a - b < 0 ? a - b + MOD : a - b; }
inline void upd(int &a, int b) { a = Add(a, b); }
int N, F[Max_N], Last[3];
char S[Max_N];
int main() {
  scanf("%s", S + 1), N = strlen(S + 1);
  bool special = true;
  for (int i = 2; i <= N; ++i)
    if (S[i] == S[i - 1]) special = false;
  if (special) {
    printf("1");
    return 0;
  }
  Last[0] = 0, Last[1] = Last[2] = -1, F[0] = 1;
  for (int i = 1, Sum = 0, a; i <= N; ++i) {
    if (i < N && Sum == 0) F[i] = 1;
    (Sum += (S[i] - 'a' + 1)) %= 3;
    a = ((Sum - 1) % 3 + 3) % 3;
    if (Last[a] != -1) upd(F[i], F[Last[a]]);
    a = ((Sum - 2) % 3 + 3) % 3;
    if (Last[a] != -1) upd(F[i], F[Last[a]]);
    Last[Sum] = i;
  }
  printf("%d", F[N]);
  return 0;
}
