#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=100005,p=1000000007;
int read(){
	int f=1,g=0;char ch=getchar();
	for (;!isdigit(ch);ch=getchar()) if (ch=='-') f=-1;
	for (;isdigit(ch);ch=getchar()) g=g*10+ch-'0';
	return f*g;
}
int n,fl,f[N],cur[3];
void check(int &x,int y){if ((x+=y)>=p) x-=p;}
char ch[N];
int main(){
	scanf("%s",ch+1);
	n=strlen(ch+1);fl=0;
	for (int i=1;i<n;i++)
	if (ch[i]==ch[i+1]) fl=1;
	if (!fl){puts("1");return 0;}
	f[0]=1;cur[0]=0;cur[1]=cur[2]=-1;
	int s=0;
	for (int i=1;i<=n;i++){
		s=(s+ch[i]-'a'+1)%3;
		cur[s]=i;
		if ((!s)&(i<n)) f[i]=1;
		if (cur[(s+1)%3]>=0) check(f[i],f[cur[(s+1)%3]]);
		if (cur[(s+2)%3]>=0) check(f[i],f[cur[(s+2)%3]]);
	}
	printf("%d\n",f[n]);
	return 0;
}