#include <bits/stdc++.h>
using namespace std;
const int M = 500005;
int main() {
  int i, j, k, l, h;
  char s[M];
  double sum = 0;
  int a[105];
  scanf("%s", s);
  sum = 0;
  memset(a, 0, sizeof(a));
  l = strlen(s);
  for (i = 0; s[i]; i++) {
    a[s[i] - '0']++;
  }
  for (i = 0; i < 105; i++) {
    sum += ((double)a[i] * a[i]);
  }
  printf("%.0lf\n", sum);
  return 0;
}
