// 21:03 - #include using namespace std; #define fi first #define se second #define all(x) x.begin(), x.end() #define lch (o << 1) #define rch (o << 1 | 1) typedef double db; typedef long long ll; typedef unsigned int ui; typedef pair pint; typedef tuple tint; const int N = 2e5 + 5; const int C = 26 + 2; const int MOD = 1e9 + 7; const int INF = 0x3f3f3f3f; const ll INF_LL = 0x3f3f3f3f3f3f3f3f; string s; ll f[C], g[C]; int main() { ios::sync_with_stdio(0); cin >> s; int n = s.size(); s = ' ' + s; f[26] = 0, g[26] = 1; ll ans = 0; for (int i = 1; i <= n; i++) { int c = s[i] - 'a'; ll nf = 0, ng = 0; for (int d = 0; d <= 26; d++) { if (c == d) { nf = (nf + f[d]) % MOD; ng = (ng + g[d]) % MOD; } else { nf = (nf + f[d] + g[d]) % MOD; ng = (ng + g[d]) % MOD; } } ans = (ans + nf) % MOD; f[c] = (f[c] + nf) % MOD; g[c] = (g[c] + ng) % MOD; } cout << ans << endl; return 0; }