#include <bits/stdc++.h>
using namespace std;

const int N = 1e5 + 5;
const int mod = 1e9 + 7;

namespace {
  inline int add(int x) {return (x >= mod) ? x - mod : x;}
  inline int sub(int x) {return (x < 0) ? x + mod : x;}
  inline void Add(int &x, int y) {x = add(x + y);}
  inline void Sub(int &x, int y) {x = sub(x - y);}
  inline int Pow(int x, int y) {
	int res = 1;
	for(; y; y >>= 1, x = 1LL * x * x % mod) {
	  if(y & 1) {
		res = 1LL * res * x % mod;
	  }
	}
	return res;
  }
}

int A[N], n, m, x, y, dp[N];
char s[N];

int tmp[N][3];

bool pd(void) {
  bool ok = 1;
  for(int i = 1; i < n; ++ i) ok &= (s[i] != s[i + 1]);
  return ok;
}

int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  for(int i = 1; i <= n; ++ i) {
	A[i] = s[i] - 'a' + 1;
	A[i] += A[i - 1];
	A[i] %= 3;
  }
  if(pd()) {
	return 0 *puts("1");
  }
  dp[0] = 1;
  tmp[n + 1][0] = tmp[n + 1][1] = tmp[n + 1][2] = n + 1;
  int ans = 0;
  for(int i = n; i >= 1; -- i) {
	for(int a = 0; a < 3; ++ a) tmp[i][a] = tmp[i + 1][a];
	tmp[i][A[i]] = min(tmp[i][A[i]], i);
  }
  //cerr << A[2] <<" " << A[3] << endl;
  for(int i = 0; i < n; ++ i) {
	for(int j = 0; j < 3; ++ j) 
	  if(A[i] != j && tmp[i + 1][j] <= n) 
		Add(dp[tmp[i + 1][j]], dp[i]);
  }
  for(int i = 1; i <= n; ++ i) if((A[i] == A[n])) Add(ans, dp[i]);
  cout << ans << endl;
}
