#include<bits/stdc++.h>
using namespace std;
#define MN 100000
#define MOD 1000000007
char s[MN+5];
int S[MN+5],t[MN+5][3],f[MN+5];
inline void rw(int&x,int y){if((x+=y)>=MOD)x-=MOD;}
int main()
{
	int n,i,j,ans=0;
	scanf("%s",s+1);n=strlen(s+1); 
	for(i=1;i<n;++i)if(s[i]==s[i+1])break;
	if(i==n)return 0*puts("1");
	for(i=1;i<=n;++i)S[i]=(S[i-1]+s[i]-'a'+1)%3;
	for(j=0;j<3;++j)t[n+1][j]=n+1;
	for(i=n;i;t[i][S[i]]=i,--i)for(j=0;j<3;++j)t[i][j]=t[i+1][j];
	for(f[0]=i=1;i<=n;(S[n]-S[i])%3?0:(rw(ans,f[i]),0),++i)
		for(j=1;j<3;++j)rw(f[t[i][(S[i-1]+j)%3]],f[i-1]);
	printf("%d",ans);
}