#include <cstring>
#include <cstdio>
#define MOD 1000000007
char str[100005];
int dp[100005], nxt[100005][5], pre[100005];
int main()
{
	// freopen("AGC027-E.in", "r", stdin);
	scanf("%s", str);
	int n = strlen(str);
	bool flg = true;
	for (int i = 1; i < n; i++)
		flg &= str[i] != str[i - 1];
	if (flg)
	{
		puts("1");
		return 0;
	}
	for (int i = 0; i < n; i++)
		pre[i] = ((i ? pre[i - 1] : 0) + (str[i] - 'a') + 1) % 3;
	nxt[n][0] = nxt[n][1] = nxt[n][2] = n;
	for (int i = n - 1; i >= 0; i--)
	{
		memcpy(nxt[i], nxt[i + 1], sizeof(nxt[i]));
		nxt[i][pre[i]] = i;
	}
	dp[0] = 1;
	for (int i = 0; i < n; i++)
	{
		int x = i ? pre[i - 1] : 0, pos = nxt[i][(x + 1) % 3];
		if (pos < n)
			(dp[pos + 1] += dp[i]) %= MOD;
		pos = nxt[i][(x + 2) % 3];
		if (pos < n)
			(dp[pos + 1] += dp[i]) %= MOD;
	}
	int ans = 0;
	for (int i = 0; i < n; i++)
	{
		if (pre[i] == pre[n - 1])
			(ans += dp[i + 1]) %= MOD;
	}
	printf("%d\n", ans);
	return 0;
}
