#include <bits/stdc++.h>
#define clr(x) memset(x,0,sizeof x)
#define For(i,a,b) for (int i=(a);i<=(b);i++)
#define Fod(i,b,a) for (int i=(b);i>=(a);i--)
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define fi first
#define se second
#define outval(x) cerr<<#x" = "<<x<<endl
#define outtag(x) cerr<<"-----------------"#x"-----------------\n"
#define outarr(a,L,R) cerr<<#a"["<<L<<".."<<R<<"] = ";\
                    For(_x,L,R) cerr<<a[_x]<<" ";cerr<<endl;
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
LL read(){
    LL x=0,f=0;
    char ch=getchar();
    while (!isdigit(ch))
        f=ch=='-',ch=getchar();
    while (isdigit(ch))
        x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
    return f?-x:x;
}
const int N=100005,mod=1e9+7;
void Add(int &x,int y){
	if ((x+=y)>=mod)
		x-=mod;
}
void Del(int &x,int y){
	if ((x-=y)<0)
		x+=mod;
}
int Add(int x){
	return x>=mod?x-mod:x;
}
int Del(int x){
	return x<0?x+mod:x;
}
int n;
int a[N],s[N];
void IN(){
	char s[N];
	cin>>s+1;
	n=strlen(s+1);
	For(i,1,n)
		a[i]=s[i]-'a'+1;
}
int p[3];
int b1[N],b2[N];
int dp[N];
int ans=0;
int main(){
	IN();
	For(i,0,2)
		p[i]=n+1;
	For(i,1,n)
		s[i]=(s[i-1]+a[i])%3;
	int las=n;
	Fod(i,n,1){
		if (i<n&&a[i]==a[i+1]){
			Fod(j,las,i+1)
				p[s[j]]=j;
			las=i;
		}
		if (a[i]==1)
			b1[i-1]=i,b2[i-1]=p[(s[i-1]+2)%3];
		else
			b2[i-1]=i,b1[i-1]=p[(s[i-1]+1)%3];
	}
	if (las==n)
		return puts("1"),0;
	dp[0]=1;
	For(i,0,n-1){
		Add(dp[b1[i]],dp[i]);
		Add(dp[b2[i]],dp[i]);
	}
	For(i,1,n)
		if ((s[n]-s[i]+3)%3==0)
			Add(ans,dp[i]);
	cout<<ans<<endl;
    return 0;
}