#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int n = s.size();
  long long sum = 0;
  long long x = 0;
  map<char, int> mp;
  for (int i = 0; i < n; i++) {
    mp[s[i]]++;
  }
  for (auto it = mp.begin(); it != mp.end(); it++) {
    x = it->second;
    x *= x;
    sum += x;
    x = 0;
  }
  cout << sum;
  return 0;
}
