#include <bits/stdc++.h>
using namespace std;
int main() {
  int i;
  std::string s;
  std::vector<long long> counts(256, 0);
  long long total = 0;
  std::cin >> s;
  for (i = 0; i < s.size(); i++) {
    ++counts[s[i]];
  }
  for (i = 0; i < 256; i++) {
    total += counts[i] * counts[i];
  }
  std::cout << total << endl;
  return 0;
}
