#include <bits/stdc++.h>
using namespace std;
char str[100010];
long long f[100010];
int nxt[3];
int main() {
  scanf("%s", str + 1);
  int n = strlen(str + 1);
  bool same = false;
  for (int i = 1; i < n && !same; i++) same = str[i] == str[i - 1];
  if (!same) {
    puts("1");
    return 0;
  }
  int u = 0;
  f[0] = 1;
  nxt[1] = nxt[2] = -1;
  for (int i = 1; i <= n; i++) {
    if (str[i] == 'a')
      u = (u + 1) % 3;
    else
      u = (u + 2) % 3;
    if (!u && i != n) f[i] = 1;
    for (int _ = 0; _ <= 1; _++)
      if (nxt[u = (u + 1) % 3] >= 0) f[i] = (f[i] + f[nxt[u]]) % 1000000007;
    u = (u + 1) % 3;
    nxt[u] = i;
  }
  printf("%lld\n", f[n]);
  return 0;
}
