#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#define ll long long
using namespace std;
template <class T>
inline void rd(T &x) {
	x=0; char c=getchar(); int f=1;
	while(!isdigit(c)) { if(c=='-') f=-1; c=getchar(); }
	while(isdigit(c)) x=x*10-'0'+c,c=getchar(); x*=f;
}
const int N=1e5+10,mod=1e9+7;
inline void Add(int &x,int y) { x+=y; if(x>=mod) x-=mod; }
inline void Dec(int &x,int y) { x-=y; if(x<0) x+=mod; }
char S[N];
int s[N],f[N],sum[N],n;
int lb[N],rb[N];
int main() {
	scanf("%s",S+1); n=strlen(S+1);
	int flg=0;
	for(int i=1;i<n;++i) flg|=S[i]==S[i+1];
	if(!flg) {
		printf("1\n");
		return 0;
	}
	for(int i=1;i<=n;++i) s[i]=s[i-1]+(S[i]-'a'+1);
	int last[3]={0,-1,-1};
	int lst=-1;
	for(int i=1;i<=n;++i) {
		if(i>1&&S[i-1]==S[i]) lst=i-2;
		rb[i]=lst;
		lb[i]=last[s[i]%3];
		last[s[i]%3]=i;
//		cout<<i<<':'<<lb[i]<<' '<<rb[i]<<endl;
	}
	f[0]=sum[0]=1;
	for(int i=1;i<=n;++i) {
		Add(f[i],f[i-1]);
		if(lb[i]<rb[i]) {
			Add(f[i],sum[rb[i]]);
			if(lb[i]>-1) Dec(f[i],sum[lb[i]]);
		}
		sum[i]=(sum[i-1]+f[i])%mod;
	}
	int ans=0;
	for(int i=1;i<=n;++i) if((s[n]-s[i])%3==0) Add(ans,f[i]);
	printf("%d",ans);
	return 0;
}