#include <bits/stdc++.h>
using namespace std;
int main() {
  map<char, int> mp;
  map<char, int>::iterator it;
  long long n;
  long long res = 0;
  string s;
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    mp[s[i]]++;
  }
  for (it = mp.begin(); it != mp.end(); it++) {
    n = it->second;
    res += (n * (n - 1) + n);
  }
  cout << res << endl;
  return 0;
}
