#include <bits/stdc++.h>
using namespace std;
char s[100000 + 5];
int S[100000 + 5], t[100000 + 5][3], f[100000 + 5];
inline void rw(int& x, int y) {
  if ((x += y) >= 1000000007) x -= 1000000007;
}
int main() {
  int n, i, j, ans = 0;
  scanf("%s", s + 1);
  n = strlen(s + 1);
  for (i = 1; i <= n; ++i) S[i] = (S[i - 1] + s[i] - 'a' + 1) % 3;
  for (j = 0; j < 3; ++j) t[n + 1][j] = n + 1;
  for (i = n; i; t[i][S[i]] = i, --i)
    for (j = 0; j < 3; ++j) t[i][j] = t[i + 1][j];
  for (f[0] = i = 1; i <= n; (S[n] - S[i]) % 3 ? 0 : (rw(ans, f[i]), 0), ++i)
    for (j = 1; j < 3; ++j) rw(f[t[i][(S[i - 1] + j) % 3]], f[i - 1]);
  printf("%d", ans);
}
