#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  map<char, int> m;
  for (int i = 0; i < s.size(); i++) {
    m[s[i]]++;
  }
  long long int ans = 0;
  for (auto x : m) {
    long long int buffer;
    buffer = x.second;
    ans += ((buffer) * (buffer));
  }
  cout << ans << endl;
  return 0;
}
