#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
using namespace std;
typedef long long LL;
const int N = 1e5+10 , mod = 1e9+7;
inline int read()
{
	register int x = 0 , f = 0; register char c = getchar();
	while(c < '0' || c > '9') f |= c == '-' , c = getchar();
	while(c >= '0' && c <= '9') x = (x << 3) + (x << 1) + c - '0' , c = getchar();
	return f ? -x : x;
}
int n;
int f[N] , lst[N] , a[N];
char s[N];
int main()
{
	scanf("%s" , s);
	for( ; s[n] ; ++n) a[n+1] = (a[n] + s[n] - 'a' + 1) % 3;
	int flag = 0;
	for(int i = 1 ; i < n ; ++i) if(s[i] == s[i - 1]) { flag = 1; break; }
	if(!flag) return puts("1") , 0;
//	for(int i = 0 ; i < n ; ++i) a[i+1] = (a[i] + s[i] - 'a' + 1) % mod;
	for(int i = 0 ; i <= 2 ; ++i) lst[i] = i == a[n] ? n : n + 1;
	f[n] = 1;
	for(int i = n - 1 ; i ; --i)
	{
		f[i] = a[i] == a[n];
		for(int j = 1 ; j <= 2 ; ++j) (f[i] += f[lst[(a[i] + j) % 3]]) %= mod;
		lst[a[i]] = i;
	}
	cout << (f[lst[1]] + f[lst[2]]) % mod << '\n';
	return 0;
}