#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie();
  char temp;
  long long p = 0;
  map<char, long long> cont;
  while (cin >> temp) cont[temp]++;
  map<char, long long>::iterator it = cont.begin();
  for (it; it != cont.end(); it++) p += it->second * it->second;
  cout << p;
  return 0;
}
