#include #include #include #include #include #include #include using namespace std; using ll = long long; constexpr int P = 1000000007; int main() { ios::sync_with_stdio(false); cin.tie(0); string s; cin >> s; int n = s.size(); ll p[26] = {}, q[26] = {}; for (int i = 0; i < n; i++) { int x = s[i] - 'a'; ll t = 0; for (int c = 0; c < 26; c++) { t += q[c] + (c != x) * p[c]; } q[x] += t; q[x]++; q[x] %= P; t = 0; for (int c = 0; c < 26; c++) { t += p[c]; } p[x] += t; p[x]++; p[x] %= P; } ll r = 0; for (int c = 0; c < 26; c++) { r += q[c]; } cout << r % P << endl; return 0; }