#include <bits/stdc++.h>
using namespace std;
string s;
map<char, long long> A;
char B[10000];
long long i, k, j, hasil;
int main() {
  cin >> s;
  k = 0;
  hasil = 0;
  for (i = 0; i < s.length(); i++) {
    A[s[i]]++;
    if (A[s[i]] == 1) {
      B[k] = s[i];
      k++;
    }
  }
  for (j = 0; j < k; j++) {
    hasil += A[B[j]] * A[B[j]];
  }
  cout << hasil << endl;
}
