#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
vector<ll> sumtable = {0, 1};
ll getsum(ll a, ll b){
return sumtable[b] - sumtable[a-1];
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
string s;
cin >> s;
s.insert(0, "-");
s.append("x");
// cout << s;
ll end, minimum, prevdist, start, mindist, MODULO;
string ascii_lowercase = "abcdefghijklmnopqrstuvwxyz";
end = s.length() - 1;
vector<ll> maxnb(end, end+1);
maxnb.push_back(-1);
minimum = end + 1;
map<char, ll> seen;
for (ll i = 0; i < 26; i++)
{
seen[ascii_lowercase[i]] = end + 1;
}
map<ll, ll> last;
for (ll i = 0; i < end+2; i++)
{
last[i] = -1;
}
deque<ll> distances;
prevdist = 9999999;
for (ll i = end; i > 0; i--)
{
minimum = min(minimum, seen[s[i]]);
if(minimum < prevdist){
distances.push_front(minimum);
prevdist = minimum;
}
maxnb[i] = minimum;
seen[s[i]] = i;
last[maxnb[i]] = max(last[maxnb[i]], i);
}
start = 1;
mindist = distances[0];
distances.pop_front();
MODULO = pow(10, 9) + 7;
for (ll i = 2; i < end + 1; i++)
{
if(i > mindist){
start = last[mindist] + 1;
mindist = distances[0];
distances.pop_front();
}
sumtable.push_back((sumtable[i-1] % MODULO + getsum(start, i-1) % MODULO) % MODULO);
}
cout << getsum(end, end) << endl;
}