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

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

using ll = long long;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int INF = 1<<30;
const ll mod = 1000000007LL;

int main(){
  string S;
  cin>>S;
  ll N = S.size();
  map<char,ll> m;
  for(ll i = 0; i < N; i++) m[S[i]]++;
  ll ans = 0LL;
  for(auto x:S){
    ans+=N-m[x];
  }
  cout<<ans/2+1<<endl;
}
#include <bits/stdc++.h>
using namespace std;

#ifdef LOCAL
#define debug(var) cerr << (#var) << " = " << (var) << endl;
#else
#define debug(var)
#endif

void init() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
}

int h[30];

void solve() {
  string s; cin >> s;
  for (int i = 0; i < (int)s.size(); ++i) {
    ++h[s[i]-'a'];
  }
  long long ans = 1LL*s.size()*(s.size()-1)/2;
  for (int i = 0; i < 30; ++i) {
    if (!h[i]) continue;
    ans -= 1LL*h[i]*(h[i]-1)/2;
  }
  printf("%lld", ans+1);
}

int main() {
  init();
  int t = 1; //scanf("%d", &t);
  while (t--) {
    solve();
  }
  return 0;
}
