#include <bits/stdc++.h>
void mm(char s[]) {
  int m[128] = {0};
  int n, i;
  double nn = 0;
  n = strlen(s);
  for (i = 0; i < n; i++) {
    nn += m[(int)s[i]] * 2 + 1;
    m[(int)s[i]]++;
  }
  printf("%0.0lf\n", nn);
}
int main() {
  char s[100010];
  while (scanf("%s", s) != EOF) mm(s);
  return 0;
}
