#include using namespace std; using ll = long long; #define SPEED cin.tie(0);ios::sync_with_stdio(false); constexpr long long MOD = 1'000'000'007LL; int main() { SPEED string S; cin >> S; array num={}; ll acc=0,sum=0,ans = 0,one=1,pow2=1; for(int i=0; i < S.size(); ++i) { int c=S[i]-'a'; ll cnt = one + acc + sum + (MOD - num[c]); ans += cnt; acc += cnt; sum += pow2; num[c]+= pow2; pow2 *= 2; if(i%3) { cnt %= MOD; ans %= MOD; acc %= MOD; sum %= MOD; num[c]%= MOD; pow2 %= MOD; } } cout << ans%MOD << "\n"; return 0; }