#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;
int n, sum[100007], dp[100007], is, pre[3] = { 0,-1,-1 };
char s[100007];
int main()
{
	scanf("%s", s + 1);
	n = strlen(s + 1);
	for (int i = 1; i <= n; i++)
		sum[i] = (sum[i - 1] + (s[i] - 'a' + 1)) % 3;
	for (int i = 2; i <= n; i++)
		if (s[i] == s[i - 1])is = 1;
	if (!is) { cout << 1 << endl; return 0; }
	dp[0] = 1;
	for (int i = 1; i <= n; i++)
	{
		if (i < n && !sum[i])dp[i] = 1;
		dp[i] = (dp[i] + dp[i - 1]) % mod;
		int v = (sum[i] + (s[i] - 'a' + 1)) % 3;
		if (pre[v] != -1)dp[i] = (dp[i] + dp[pre[v]]) % mod;
		pre[sum[i]] = i;
	}
	cout << dp[n] << endl;
	return 0;
}