#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
const ll inf=1e12;


string s;
int h[26];
int main(){
    cin>>s;
    ll ans=1;
    for(int i=0;i<s.length();i++){
        h[s[i]-'a']++;
        ans+=i+1-h[s[i]-'a'];
    }
    cout<<ans;
}
