#include <bits/stdc++.h>
#define int long long
using namespace std;

signed main(){
  string s;
  cin>>s;
  int N=s.size();
  int ans=N*(N-1)/2+1;
  std::vector<int> v(26,0);
  for(int i=0;i<N;i++)v[s[i]-'a']++;
  for(int i=0;i<26;i++)ans-=v[i]*(v[i]-1)/2;
  cout<<ans<<endl;
}
