#include <bits/stdc++.h>
using namespace std;
int main() {
  map<char, int> Q;
  char str[100110];
  scanf("%s", str);
  long long len = strlen(str);
  for (int i = 0; i < len; i++) {
    Q[str[i]]++;
  }
  map<char, int>::iterator it;
  it = Q.begin();
  long long cnt = 0;
  for (; it != Q.end(); it++) {
    cnt += (long long)it->second * it->second;
  }
  printf("%lld\n", cnt);
}
