#include <bits/stdc++.h>
using namespace std;
string s;
long long c[36] = {0};
int main() {
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] >= 'a' && s[i] <= 'z')
      c[(s[i] - 'a')]++;
    else
      c[26 + (s[i] - '0')]++;
  }
  long long sum = 0;
  for (int j = 0; j < 36; j++) sum += (c[j] * c[j]);
  cout << sum;
  return 0;
}
