#include <bits/stdc++.h>
using namespace std;
char buf[1111111];
int main() {
  gets(buf);
  int n = strlen(buf);
  map<char, int> m;
  for (int _n((n)-1), i(0); i <= _n; i++) m[buf[i]]++;
  long long res = 0;
  for (map<char, int>::iterator it = m.begin(); it != m.end(); it++) {
    res += it->second * (long long)(it->second);
  }
  cout << res << endl;
  return 0;
}
