#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>

using namespace std;
const int maxn = 1e5+5;
int mod = 1e9+7;
void up(int &x,int y) { x+=y; if(x>=mod)x-=mod; }
int n;
char ss[maxn];
int sm[maxn],f[maxn],nt[3];
int main() {
	scanf("%s",&ss[1]);
	n = strlen(ss+1);
	bool fl = 0;
	for(int i=1;i<=n;i++) {
		sm[i] = (sm[i-1] + ss[i]-'a'+1)%3;
	}
	for(int i=1;i<n;i++) fl |= (ss[i]==ss[i+1]);
	if(!fl) {
		puts("1"); return 0;
	}
	f[n] = 1;
	for(int i=0;i<3;i++) nt[i] = n+1;
	nt[sm[n]] = n;
	for(int i=n-1;i>=1;i--) {
		if(sm[i]==sm[n]) f[i] = 1;
		up(f[i],f[nt[(sm[i]+1)%3]]);
		up(f[i],f[nt[(sm[i]+2)%3]]);
		nt[sm[i]] = i;
	}
	printf("%d",(f[nt[1]]+f[nt[2]])%mod);
}