#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a[40];
  memset(a, 0, sizeof(a));
  string s;
  cin >> s;
  for (int i = 0; i < s.length(); i++) {
    if (isalpha(s[i]))
      a[s[i] - 'a']++;
    else
      a[s[i] - '0' + 26]++;
  }
  long long t = 0;
  for (int i = 0; i <= 35; i++) t += (a[i] * a[i]);
  cout << t;
  return 0;
}
