#include using namespace std; using ll = long long; #define rep(i, n) for(int i=0; i= MOD) x -= MOD; return *this; } mint& operator-=(const mint a) { if ((x -= a.x) < 0) x += MOD; return *this; } mint& operator*=(const mint a) { (x *= a.x) %= MOD; return *this; } mint operator+(const mint a) const { return mint(*this) += a; } mint operator-(const mint a) const { return mint(*this) -= a; } mint operator*(const mint a) const { return mint(*this) *= a; } }; ostream& operator<<(ostream& os, const mint& a) { return os << a.x; } using Vm = vector; int main() { const int M = 26; string s; cin >> s; int n = s.size(); Vm pw(n+1); pw[0] = 1; rep(i, n) pw[i+1] = pw[i] + pw[i]; Vm dp(M+1); dp[M] = 1; mint ans = pw[n] - 1; rep(i, n) { Vm _dp = dp; int x = s[i] - 'a'; rep(j, M+1) { _dp[x] += dp[j]; if (x != j && j < M) ans += dp[j] * pw[n-1-i]; } swap(dp, _dp); } cout << ans << "\n"; return 0; }