#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; } mint pow(ll t) const { if (!t) return 1; mint a = pow(t>>1); a *= a; if (t&1) a *= *this; return 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 dp(M+1); dp[M] = 1; mint ans = mint(2).pow(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] * mint(2).pow(n-1-i); } swap(dp, _dp); } cout << ans << "\n"; return 0; }