#include using namespace std; typedef long long ll; #define pb push_back #define fi first #define se second typedef pair P; using VP = vector

; using VVP = vector; using VI = vector; using VVI = vector; using VVVI = vector; const int inf = 1e9 + 7; const ll INF = 1LL << 61; const ll mod = 1e9 + 7; 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; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int i, j; string s; cin >> s; VI v(26, 0); ll all = 0; ll r = 1; for (i = 0; i < s.size(); i++) { ll z = (mod + all - v[s[i] - 'a'] + r) % mod; v[s[i] - 'a'] += r; v[s[i] - 'a'] %= mod; all += z; all %= mod; r = r * 2 % mod; } cout << all << endl; }