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