#include <bits/stdc++.h>
using namespace std;
int main() {
  string str;
  cin >> str;
  map<char, long long> mp;
  long long cnt = 0;
  for (int i = 0; i < str.size(); i++) {
    mp[str[i]]++;
  }
  for (map<char, long long>::iterator i = mp.begin(); i != mp.end(); i++) {
    cnt += pow(i->second, 2);
  }
  cout << cnt << endl;
}
