#include <bits/stdc++.h>
using namespace std;
long long a[200];
int main() {
  char s;
  while (cin >> s, cin) a[s]++;
  long long ans = 0;
  for (int i = 0; i < 200; ++i) ans += a[i] * a[i];
  cout << ans << endl;
  return 0;
}
