// by newbiechd
#include <algorithm>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>

// DELETE the debugging information!
#define debug(x) std::cerr << #x << " = " << (x) << std::endl

int read() {
  int f = 0;
  char ch;
  while (!isdigit(ch = getchar()));
  do f = 10 * f + (ch ^ '0');
  while (isdigit(ch = getchar()));
  return f;
}

const int N_MAX = 100003, mod = 1e9 + 7;
char s[N_MAX];
int dp[N_MAX];
void add(int &x, const int &y) {
  x += y - mod;
  x += x >> 31 & mod;
}

int main() {
  scanf("%s", s + 1);
  int n = strlen(s + 1), lst = n + 1, sum = 0;
  dp[n + 1] = 1;
  for (int i = n; i > 0; --i) {
    sum = (sum + s[i] - 'a' + 1) % 3;
    if (s[i] == s[i + 1])
      lst = i + 1;
    dp[i] = (dp[i + 1] + dp[lst + 1] + (sum == 0)) % mod;
  }
  printf("%d\n", lst <= n ? (dp[1] - (sum == 0) + mod) % mod : 1);
  return 0;
}
