#include <bits/stdc++.h>
using namespace std;
int main() {
  long long h = 1, i, t, ans = 1, sum = 0;
  string s;
  cin >> s;
  sort(s.begin(), s.end());
  for (i = 1; i < s.length(); i++) {
    if (s[i] == s[i - 1])
      h++;
    else
      sum += (h * (h - 1)), h = 1;
  }
  if (s[i - 1] == s[i - 2]) sum += h * (h - 1);
  cout << sum + s.length() << endl;
  return 0;
}
