#include <bits/stdc++.h>
using namespace std;
int add(int x, int y) { return x + y < 3 ? x + y : x + y - 3; }
const int mod = 1e9 + 7;
int n;
char s[100100];
int a[100100];
int sum[100100];
int nd[100100];
int nxt[100100][3];
int dp[100100];
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  for (int i = 1; i <= n; ++i) {
    a[i] = s[i] - 'a' + 1;
    sum[i] = add(sum[i - 1], a[i]);
  }
  a[n + 2] = 4;
  nxt[n][0] = nxt[n][1] = nxt[n][2] = n + 1;
  nxt[n + 1][0] = nxt[n + 1][1] = nxt[n + 1][2] = n + 1;
  nd[n + 1] = n + 1;
  for (int i = n; i >= 0; --i) {
    memcpy(nxt[i], nxt[i + 1], sizeof(nxt[i + 1]));
    nxt[i][sum[i]] = i;
    nd[i] = nd[i + 1];
    if (a[i + 1] == a[i + 2]) nd[i] = i + 2;
  }
  if (nd[1] == n + 1) {
    puts("1");
    return 0;
  }
  dp[0] = 1;
  int p1, p2;
  for (int i = 0; i < n; ++i) {
    p1 = nxt[nd[i]][add(sum[i], 1)];
    p2 = nxt[nd[i]][add(sum[i], 2)];
    if (a[i + 1] != 1) dp[p1] = (dp[p1] + dp[i]) % mod;
    if (a[i + 1] != 2) dp[p2] = (dp[p2] + dp[i]) % mod;
    dp[i + 1] = (dp[i + 1] + dp[i]) % mod;
  }
  int ans = 0;
  for (int i = 1; i <= n; ++i)
    if (add(sum[n], 3 - sum[i]) == 0) (ans += dp[i]) %= mod;
  printf("%d\n", ans);
  return 0;
}
