#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  long long a[200];
  memset(a, 0, sizeof(a));
  getline(cin, s);
  for (int i = 0; i < s.length(); i++) a[(int)s[i]]++;
  long long sum = 0;
  for (int i = 0; i < 200; i++) sum += (long long)pow((double)a[i], 2.0);
  cout << sum << endl;
  return 0;
}
