#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const double eps = 1e-6;
char s[100005];
int num[1005];
int main() {
  memset(num, 0, sizeof(num));
  scanf("%s", s);
  int n = strlen(s), maxn = 0, minn = 1005;
  for (int i = 0; i < n; i++) {
    num[s[i]]++;
    minn = min(minn, (int)s[i]);
    maxn = max(maxn, (int)s[i]);
  }
  long long ans = 0;
  for (int i = minn; i <= maxn; i++)
    if (num[i]) ans += (long long)num[i] * (long long)num[i];
  printf("%lld\n", ans);
  return 0;
}
