#include<bits/stdc++.h>
#define N 100100
#define mo 1000000007
using namespace std;
int n,ap[17][N],t[N],pr[N],f[N],a[N];
char s[N];
int main(){
	scanf("%s",s+1);n=strlen(s+1);
	for(int i=2;i<=n;++i)t[i]=t[i-1]+(s[i]==s[i-1]);
	for(int i=1;i<=n;++i){
		pr[i]=(pr[i-1]+(a[i]=s[i]-96))%3;
		ap[0][i]=1<<pr[i];
	}
	for(int j=1;j<=16;++j)for(int i=1,_E_=n+1-(1<<j);i<=_E_;++i)ap[j][i]=ap[j-1][i]|ap[j-1][i+(1<<j-1)];
	f[0]=1;
	for(int i=0;i<n;++i){
		f[i+1]=(f[i+1]+f[i])%mo;
		int l=i+1,r=n,m,s=n+1;
		while(l<=r)if(t[m=l+r>>1]!=t[i+1])r=m-1,s=m;else l=m+1;
		if(s>n)continue;
		for(int j=16;j+1;--j)if(s+(1<<j)<=n+1&&!(ap[j][s]&1<<(3+pr[i]-a[i+1])%3))s+=1<<j;
		if(s>n)continue;
		f[s]=(f[s]+f[i])%mo;
	}int ans=f[n]%mo;
	if(t[n])for(int i=n-1;i;--i)if(pr[n]==pr[i])ans=(ans+f[i])%mo;
	printf("%d",ans);
}