#include <bits/stdc++.h>
using namespace std;
char s[100010];
int main() {
  int l, i;
  long long a, f;
  while (scanf("%s", s) != EOF) {
    l = strlen(s);
    sort(s, s + l);
    a = 0;
    f = 0;
    for (i = 1; i < l; i++)
      if (s[i] != s[i - 1]) {
        a += pow((f - i), 2);
        f = i;
      }
    a += (long long)((f - i) * (f - i));
    printf("%lld\n", a);
  }
  return 0;
}
