#include <bits/stdc++.h>
using namespace std;
int main() {
  string S;
  cin >> S;
  int length = S.length();
  vector<long long int> was(36, 0);
  for (int i = 0; i < length; ++i) {
    if (S[i] <= 57) {
      ++was[S[i] - 48];
    } else {
      ++was[S[i] - 87];
    }
  }
  long long int res = 0;
  for (int i = 0; i < 36; ++i) {
    res += was[i] * was[i];
  }
  cout << res;
  return 0;
}
