#include <bits/stdc++.h>
using namespace std;
int main() {
  int aux[200], n;
  char inStr[100000];
  double ans;
  while (cin >> inStr) {
    ans = 0;
    memset(aux, 0, sizeof(aux));
    n = strlen(inStr);
    for (int i = 0; i < n; i++) aux[inStr[i]]++;
    for (int i = '0'; i <= 'z'; i++) ans += (double)aux[i] * aux[i];
    printf("%.0lf\n", ans);
  }
  return 0;
}
