#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, r, avg, m, k, t, x, y, i, j, b, d, MOD = 1073741824,
                                                      count = 0, ans = 0;
  string s;
  cin >> s;
  long long int a[36] = {0};
  for (i = 0; i < s.size(); i++) {
    if (s[i] - 'a' >= 0) {
      a[s[i] - 'a' + 10]++;
    } else {
      x = s[i] - 48;
      a[x]++;
    }
  }
  for (i = 0; i < 36; i++) {
    count += pow(a[i], 2);
  }
  cout << count;
  return 0;
}
