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