#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  long long p[100000] = {0}, r = 0;
  cin >> s;
  for (long long i = 0; i < s.size(); i++) {
    p[s[i]]++;
  }
  for (long long i = 0; i < 100000; i++) r += (p[i] * p[i]);
  cout << r << endl;
  return 0;
}
