#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

ll N;
string s;


int main(){
  cin>>s;
  N=s.size();
  ll ans=N*(N-1)/2;
  ll cnt[26]={};
  for(int i=0;i<N;i++)cnt[ s[i]-'a' ]++;

  for(int i=0;i<26;i++){
    ans-= cnt[i]*(cnt[i]-1)/2;
  }

  cout<<ans+1<<endl;
  return 0;
}
