#include <bits/stdc++.h>
using namespace std;
int a[256];
int main() {
  string s;
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    a[s[i]]++;
  }
  long long sum = 0;
  for (int i = 0; i < 256; i++) {
    sum += ((long long)a[i] * a[i]);
  }
  cout << sum << endl;
  return 0;
}
