#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <cmath>
#include <climits>
#include <string>
#include <map>
#include <set>
#include <list>

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;A++)

using namespace std;

/////////////////////////////////////////////////////
#define mp make_pair
#define MOD (ll)(1e9+7)

char s[101010];
ll dp[101010][2];
ll i, j, k,o;

int main(){
    scanf("%s",s);
    for (i = 1; s[i];i++){
        if(s[i]==s[i-1]){
            break;
        }
    }
    if(s[i]=='\0'){
        printf("1");
        return 0;
    }
    
    for (i = 0; s[i];i++){
        ll ab = (s[i] - 'a');
        dp[i + 1][ab] = (dp[i][ab] + dp[i][!ab]) % MOD;
        dp[i + 1][!ab] = (dp[i][ab]) % MOD;
        if(o==0){
            dp[i + 1][ab]++;
            dp[i + 1][ab] %= MOD;
        }
        o = (o + ab + 1) % 3;
    }
    printf("%lld", (dp[i][0]+dp[i][1])%MOD);
    return 0;
}