#include <bits/stdc++.h>
using namespace std;
long long ff[38], ans;
int main() {
  char a[100011];
  long long i, j, k;
  scanf("%s", a);
  k = strlen(a);
  for (i = 0; i < k; i++) {
    if (a[i] >= '0' && a[i] <= '9')
      ff[a[i] - '0']++;
    else
      ff[a[i] - 'a' + 10]++;
  }
  for (i = 0; i < 38; i++) {
    ans = ans + ff[i] * ff[i];
  }
  printf("%I64d\n", ans);
}
