#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  map<char, long long> m;
  cin >> s;
  long long count = 0;
  for (int i = 0; i < s.length(); i++) {
    m[s[i]] += 1;
  }
  for (map<char, long long>::iterator it = m.begin(); it != m.end(); ++it) {
    count += (it->second) * (it->second);
  }
  cout << count << endl;
  return 0;
}
