#include<cstdio>
#include<algorithm>
#include<cstring>
#define ll long long
using namespace std;
const ll MOD=1e9+7;
int n,nxt[100005];
char s[100005];
ll f[100005],ans;
int main()
{
	scanf("%s",s+1);
	n=(int)strlen(s+1);
	nxt[n]=n+1;
	for(int i=n;i>=1;i--)nxt[i-1]=s[i]==s[i+1]?i+1:nxt[i];
	f[0]=1;
	for(int i=0;i<=n;i++)
	{
		f[i]%=MOD;
		f[i+1]+=f[i];
		f[nxt[i]]+=f[i];
	}
	int now=0;
	bool flag=0;
	for(int i=n;i>=1;i--)
	{
		flag|=s[i]==s[i+1];
		if(now==0)ans+=f[i];
		now=(now+s[i]-'a'+1)%3;
	}
	if(!flag)printf("1\n");
	else printf("%lld\n",ans%MOD);
	return 0;
}