#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int count = 0, c;
  int j;
  string s;
  cin >> s;
  sort(s.begin(), s.end());
  unsigned int l = s.length();
  for (unsigned int i = 0; i < l; ++i) {
    c = 0;
    char p = s[i];
    for (j = i; j < l; j++) {
      if (s[j] != p) break;
      if (s[j] == p) c++;
    }
    count += c * c;
    i = j - 1;
  }
  cout << count;
}
