#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  while (cin >> s) {
    vector<long long> table(128, 0);
    long long ans = 0;
    for (int i = 0; i < s.length(); i++) {
      table[s[i]]++;
    }
    for (int i = 0; i < 128; i++) {
      ans += table[i] * table[i];
    }
    cout << ans << endl;
  }
  return 0;
}
