#include<cstdio>
#include<cstring>
char s[100050];
int mo=1e9+7;
int pre[4],dp[100050],flag,tmp,cnt,ans;
int main(){
	scanf("%s",s+1);
	int n=strlen(s+1);
	for (int i=1;i<n;i++)if (s[i]==s[i+1]){flag=1;break;}
	if (!flag){printf("1\n");return 0;}
	dp[0]=1;
	pre[0]=0,pre[1]=pre[2]=-1;
	for (int i=1;i<=n;i++){
		tmp=(tmp+s[i]-'a'+1)%3;
		if (!tmp&&i<n)dp[i]=1;
		for (int j=1;j<=2;j++)if (pre[(tmp+j)%3]!=-1)dp[i]=(dp[i]+dp[pre[(tmp+j)%3]])%mo;
		pre[tmp]=i;
	}
	/*for (int i=1;i<=n;i++){
		cnt=(cnt+s[i]-'a'+1)%3;
		if (cnt==tmp)ans=(ans+dp[i])%mo;
	}*/
	printf("%d",dp[n]);
}