#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int MAX_N = 1e5 + 10;
const ll MOD = 1e9 + 7;

int N, S[MAX_N], pref_sum[MAX_N], next_sum[MAX_N][3];
ll F[MAX_N];

void init() {
    char _S[MAX_N]; scanf("%s", _S + 1); N = strlen(_S + 1);
    for (int i = 1; i <= N; i++) S[i] = _S[i] - 'a' + 1;

    bool flag = true;
    for (int i = 2; i <= N; i++) flag &= S[i] != S[i - 1];
    if (flag) {
        printf("1\n");
        exit(0);
    }

    for (int i = 1; i <= N; i++) pref_sum[i] = (pref_sum[i - 1] + S[i]) % 3;
    for (int i = 0; i < 3; i++) next_sum[N + 1][i] = N + 1;
    for (int i = N; i; i--) {
        for (int j = 0; j < 3; j++) next_sum[i][j] = next_sum[i + 1][j];
        next_sum[i][pref_sum[i]] = i;
    }
}

void solve() {
    ll ans = 0;
    F[0] = 1;
    for (int i = 1; i <= N; i++) {
        for (int j = 1; j <= 2; j++) {
            int t = next_sum[i][(pref_sum[i - 1] + j) % 3];
            if (t <= N) (F[t] += F[i - 1]) %= MOD;
        }
        if (pref_sum[N] != pref_sum[i - 1]) (ans += F[i - 1]) %= MOD;
    }
    printf("%lld\n", ans);
}

int main() {
    init();
    solve();
}