#include <bits/stdc++.h>
using namespace std;
const int N = 100005, M = 1e9 + 7;
int sum[N], dp[N], nxt[N][3];
char s[N];
int main() {
  scanf("%s", s + 1);
  int n = strlen(s + 1);
  for (int i = 1; i <= n; i++) sum[i] = (sum[i - 1] + s[i] - 'a' + 1) % 3;
  for (int i = 0; i < 3; i++) nxt[n + 1][i] = n + 1;
  for (int i = n; i; i--)
    for (int j = 0; j < 3; j++)
      if (j == sum[i])
        nxt[i][j] = i;
      else
        nxt[i][j] = nxt[i + 1][j];
  dp[0] = 1;
  for (int i = 0; i <= n; i++)
    for (int j = 1; j < 3; j++)
      (dp[nxt[i + 1][(j + sum[i]) % 3]] += dp[i]) %= M;
  int ans = 0;
  for (int i = 1; i <= n; i++)
    if (sum[i] == sum[n]) (ans += dp[i]) %= M;
  printf("%d\n", ans);
}
