#include <bits/stdc++.h>
#pragma warning(disable : 4786)
using namespace std;
char str[100005];
int f[300];
int main() {
  int i, j, k, tests, cs = 0, n;
  scanf("%s", str);
  for (i = 0; str[i]; i++) f[str[i]]++;
  long long ans = 0;
  for (i = 0; i < 300; i++) {
    if (!f[i]) continue;
    ans += (long long)f[i] * f[i];
  }
  printf("%I64d\n", ans);
  return 0;
}
