#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
const int N = 1e5 + 5;
const int mod = 1e9 + 7;
int n, a[N], flag, f[N], last[5];
char s[N];
inline int read()
{
	int x = 0, f = 1; char ch = getchar();
	while(ch < '0' || ch > '9') {if(ch == '-') f = -1; ch = getchar();}
	while(ch >= '0' && ch <= '9') {x = (x << 3) + (x << 1) + (ch ^ 48); ch = getchar();}
	return x * f;
}
int main()
{
//	freopen(".in", "r", stdin);
//	freopen(".out", "w", stdout);
	scanf("%s", s + 1); n = strlen(s + 1);
	for(int i = 1; i <= n; i ++) if(s[i] == s[i - 1]) flag = 1;
	if(!flag) {puts("1"); return 0;}
	for(int i = 1; i <= n; i ++) a[i] = (a[i - 1] + s[i] - 'a' + 1) % 3;
	for(int i = 1; i <= n; i ++)
	{
		f[i] = ((f[last[0]] + f[last[1]] + f[last[2]] - f[last[a[i]]] + (a[i] >= 1)) % mod + mod) % mod;
		last[a[i]] = i;
	}
	printf("%d\n", f[n]);
	fclose(stdin);
	fclose(stdout);
	return 0;
}
