#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  unsigned long long int n = s.length(), i, ans = 0;
  unsigned long long int arr[26] = {0}, d[10] = {0};
  for (i = 0; i < n; i++) {
    if (s[i] >= 97)
      arr[s[i] - 97]++;
    else
      d[s[i] - 48]++;
  }
  for (i = 0; i < 26; i++) ans += arr[i] * arr[i];
  for (i = 0; i < 10; i++) ans += d[i] * d[i];
  cout << ans;
  return 0;
}
