#include using namespace std; #define int ll using ll = long long; const int MOD = 1e9 + 7; int32_t main() { cin.tie(0)->sync_with_stdio(0); string s; cin >> s; int n = s.size(); vector cnt(26), dp(26); int tot = 0, pot = 1; for (int i = 0; i < n; i++) { int ans = tot + 1; for (int j = 0; j < 26; j++) { if (s[i] - 'a' != j) ans = (ans + cnt[j]) % MOD; } dp[s[i] - 'a'] = (dp[s[i] - 'a'] + ans) % MOD; cnt[s[i] - 'a'] = (cnt[s[i] - 'a'] + pot) % MOD; pot = pot*2 % MOD; tot = (tot + ans) % MOD; } cout << tot << endl; }