#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll fre[30];const ll mod=1e9+7;
ll pre[30][1000006];vector<int>v[30];
ll fac[1000006],inv[1000006];
ll pow1(ll a,ll b)
{
ll res=1;
while(b!=0)
{
if(b&1)
res=(res*a)%mod;
a=(a*a)%mod;
b>>=1;
}
return (res+mod)%mod;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
fac[0]=1,inv[0]=1;
for(int i=1;i<=1000002;i++)
{
fac[i]=(fac[i-1]*i)%mod;
inv[i]=pow1(fac[i],mod-2);
}
for(int i=0;i<=26;i++)fre[i]=0;
string s;cin>>s;int l=(int)s.length();
for(int i=0;i<=25;i++)
{
for(int j=0;j<=1000002;j++)
pre[i][j]=0;
}
for(int i=0;i<(int)s.length();i++)
{
fre[s[i]-'a']++;
pre[s[i]-'a'][i]=1;
v[s[i]-'a'].push_back(i);
}
for(int i=0;i<=25;i++)
{
for(int j=1;j<=1000002;j++)
pre[i][j]+=pre[i][j-1];
}
ll ans=0;
for(int i=0;i<=25;i++)
{
if(fre[i]>=4)
{
ll temp=fac[fre[i]];
temp=(temp*inv[4])%mod;
temp=(temp*inv[fre[i]-4])%mod;
ans=(ans+temp)%mod;
}
}
for(int i=0;i<=25;i++)
{
int num=v[i].size();
for(int j=0;j<num-1;j++)
{
int a=v[i][j],b=v[i][j+1];
for(int k=0;k<=25;k++)
{
if(i==k)continue;
ll q=pre[k][b]-(pre[k][a]);
ll after=(ll)num-pre[i][b];
after=(after+1)%mod;
ll before=((a-1)>=0? pre[i][a-1]:0);
before=(before+1)%mod;
before=((before)*(after))%mod;
if(q>=2){
ll temp=(q*(q-1))/2;
temp=temp%mod;
ans=(ans+((before*temp)%mod))%mod;}
}
}
// if(i==('h'-'a'))
// cout<<ans;
}
cout<<(ans+mod)%mod<<"\n";
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKdHlwZWRlZiBsb25nIGxvbmcgbGw7CmxsIGZyZVszMF07Y29uc3QgbGwgbW9kPTFlOSs3OwpsbCBwcmVbMzBdWzEwMDAwMDZdO3ZlY3RvcjxpbnQ+dlszMF07CmxsIGZhY1sxMDAwMDA2XSxpbnZbMTAwMDAwNl07CmxsIHBvdzEobGwgYSxsbCBiKQp7CiAgICBsbCByZXM9MTsKICAgIHdoaWxlKGIhPTApCiAgICB7CiAgICAgICAgaWYoYiYxKQogICAgICAgICAgICByZXM9KHJlcyphKSVtb2Q7CiAgICAgICAgYT0oYSphKSVtb2Q7CiAgICAgICAgYj4+PTE7CiAgICB9CiAgICByZXR1cm4gKHJlcyttb2QpJW1vZDsKfQppbnQgbWFpbigpCnsKICAgIGlvc19iYXNlOjpzeW5jX3dpdGhfc3RkaW8oZmFsc2UpOwogICAgY2luLnRpZShOVUxMKTsKICAgIGZhY1swXT0xLGludlswXT0xOwogICAgZm9yKGludCBpPTE7aTw9MTAwMDAwMjtpKyspCiAgICB7CiAgICAgICAgZmFjW2ldPShmYWNbaS0xXSppKSVtb2Q7CiAgICAgICAgaW52W2ldPXBvdzEoZmFjW2ldLG1vZC0yKTsKICAgIH0KICAgIGZvcihpbnQgaT0wO2k8PTI2O2krKylmcmVbaV09MDsKICAgIHN0cmluZyBzO2Npbj4+cztpbnQgbD0oaW50KXMubGVuZ3RoKCk7CiAgICBmb3IoaW50IGk9MDtpPD0yNTtpKyspCiAgICB7CiAgICAgICAgZm9yKGludCBqPTA7ajw9MTAwMDAwMjtqKyspCiAgICAgICAgICAgIHByZVtpXVtqXT0wOwogICAgfQogICAgZm9yKGludCBpPTA7aTwoaW50KXMubGVuZ3RoKCk7aSsrKQogICAgewogICAgICAgIGZyZVtzW2ldLSdhJ10rKzsKICAgICAgICBwcmVbc1tpXS0nYSddW2ldPTE7CiAgICAgICAgdltzW2ldLSdhJ10ucHVzaF9iYWNrKGkpOwogICAgfQogICAgZm9yKGludCBpPTA7aTw9MjU7aSsrKQogICAgewogICAgICAgIGZvcihpbnQgaj0xO2o8PTEwMDAwMDI7aisrKQogICAgICAgICAgICBwcmVbaV1bal0rPXByZVtpXVtqLTFdOwogICAgfQogICAgbGwgYW5zPTA7CiAgICBmb3IoaW50IGk9MDtpPD0yNTtpKyspCiAgICB7CiAgICAgICAgaWYoZnJlW2ldPj00KQogICAgICAgIHsKICAgICAgICAgICAgbGwgdGVtcD1mYWNbZnJlW2ldXTsKICAgICAgICAgICAgdGVtcD0odGVtcCppbnZbNF0pJW1vZDsKICAgICAgICAgICAgdGVtcD0odGVtcCppbnZbZnJlW2ldLTRdKSVtb2Q7CiAgICAgICAgICAgIGFucz0oYW5zK3RlbXApJW1vZDsKICAgICAgICB9CiAgICB9CgogICAgZm9yKGludCBpPTA7aTw9MjU7aSsrKQogICAgewogICAgICAgIGludCBudW09dltpXS5zaXplKCk7CiAgICAgICAgZm9yKGludCBqPTA7ajxudW0tMTtqKyspCiAgICAgICAgewogICAgICAgICAgICBpbnQgYT12W2ldW2pdLGI9dltpXVtqKzFdOwogICAgICAgICAgICBmb3IoaW50IGs9MDtrPD0yNTtrKyspCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGlmKGk9PWspY29udGludWU7CiAgICAgICAgICAgICAgICBsbCBxPXByZVtrXVtiXS0ocHJlW2tdW2FdKTsKICAgICAgICAgICAgICAgIGxsIGFmdGVyPShsbCludW0tcHJlW2ldW2JdOwogICAgICAgICAgICAgICAgYWZ0ZXI9KGFmdGVyKzEpJW1vZDsKICAgICAgICAgICAgICAgIGxsIGJlZm9yZT0oKGEtMSk+PTA/IHByZVtpXVthLTFdOjApOwogICAgICAgICAgICAgICAgYmVmb3JlPShiZWZvcmUrMSklbW9kOwogICAgICAgICAgICAgICAgYmVmb3JlPSgoYmVmb3JlKSooYWZ0ZXIpKSVtb2Q7CiAgICAgICAgICAgICAgICBpZihxPj0yKXsKICAgICAgICAgICAgICAgIGxsIHRlbXA9KHEqKHEtMSkpLzI7CiAgICAgICAgICAgICAgICB0ZW1wPXRlbXAlbW9kOwogICAgICAgICAgICAgICAgYW5zPShhbnMrKChiZWZvcmUqdGVtcCklbW9kKSklbW9kO30KICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgIC8vIGlmKGk9PSgnaCctJ2EnKSkKICAgICAgICAgLy8gICBjb3V0PDxhbnM7CiAgICB9CiAgICBjb3V0PDwoYW5zK21vZCklbW9kPDwiXG4iOwogICAgcmV0dXJuIDA7Cn0K