#include <bits/stdc++.h>
const int N = 100005, mod = 1000000007;
void up(int &x, int y) { x += y - mod, x += x >> 31 & mod; }
int n, dp[N], nxt[N], ans;
char s[N];
int main() {
  std::ios::sync_with_stdio(0), std::cin.tie(0);
  std::cin >> s + 1, n = std::strlen(s + 1), dp[0] = 1;
  nxt[n + 1] = n + 1;
  for (int i = n; i >= 1; --i) nxt[i] = s[i] == s[i + 1] ? i + 1 : nxt[i + 1];
  for (int i = 0; i < n; ++i) up(dp[i + 1], dp[i]), up(dp[nxt[i + 1]], dp[i]);
  for (int i = n, S = 0; i >= 1; S += s[i--])
    if (!(S % 3)) up(ans, dp[i]);
  std::cout << ans << '\n';
  return 0;
}
