#include using namespace std; typedef long long ll; typedef pair l_l; typedef pair i_i; template inline bool chmax(T &a, T b) { if(a < b) { a = b; return true; } return false; } template inline bool chmin(T &a, T b) { if(a > b) { a = b; return true; } return false; } const long long INF = 1e18; const ll mod = 1000000007; ll dp[201000][26]; ll beki[201000]; ll ans; int main() { cin.tie(0); ios::sync_with_stdio(false); string S; beki[0] = 1; for(int i = 1; i <= 2e5; i++) { beki[i] = beki[i-1] * 2 % mod; } cin >> S; ll N = S.size(); for(int i = 0; i < S.size(); i++) { int to = (int)(S[i] - 'a'); for(int j = 0; j < 26; j++) { dp[i+1][j] += dp[i][j]; dp[i+1][j] %= mod; dp[i+1][to] += dp[i][j]; dp[i+1][to] %= mod; if(to != j) { ans += dp[i][j] * beki[N - 1 - i]; ans %= mod; } } dp[i+1][to] += 1; ans += beki[N-1-i]; ans %= mod; } cout << ans << endl; return 0; }