#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
#define f(a,b) a=(a+b)%mod
typedef long long ll;

using namespace std;
string s;
#define N 100010
ll d[N],cs[N];
vector<int> v[3];
int main(){
    cin>>s;cs[0]=0;
    lol(i,s.size()){
	s[i]=s[i]-'a'+1;
	cs[i+1]=cs[i]+s[i];
	v[cs[i+1]%3].push_back(i+1);
    }
    ll p[3]={0,0,0};d[0]=1;
    lol(i,s.size())lol(j,2){
	ll r=(cs[i]+j+1)%3;
	for(;p[r]<v[r].size()&&v[r][p[r]]<=i;p[r]++){}
	if(p[r]!=v[r].size())f(d[v[r][p[r]]],d[i]);
    }
    ll cnt=cs[s.size()],ans=0;
    for(int i=0;i<s.size();i++){
	cnt-=s[i]-'a'+1;
	if(cnt%3==0)f(ans,d[i+1]);
    }
    bool ok=0;lol(i,s.size()-1)ok|=(s[i]==s[i+1]);
    cout<<(ok?ans:1)<<endl;
    return 0;
}
