#include <bits/stdc++.h>
using namespace std;
int compare(const void* a, const void* b) { return *(char*)a - *(char*)b; }
int main() {
  char s[100001];
  int i;
  unsigned long long res = 0, same;
  gets(s);
  qsort(s, strlen(s), sizeof(char), compare);
  for (i = 0; s[i]; i++) {
    same = 1;
    while (s[i] == s[i + 1]) {
      same++;
      i++;
    }
    res += same * same;
  }
  cout << res;
}
