#include <bits/stdc++.h>
using namespace std;
int main() {
  string S;
  getline(cin, S);
  long long tam = S.size();
  long long e;
  sort(S.begin(), S.end());
  long long total = 0;
  for (long long i = 0; i < tam; i++) {
    e = count(S.begin(), S.end(), S[i]);
    total += pow(e, 2);
    i = S.find_last_of(S[i]);
  }
  cout << total;
}
