#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  unordered_map<char, long long int> mp;
  for (int i = 0; i < s.length(); i++) mp[s[i]]++;
  long long int count = 0;
  for (auto p : mp) count += ((p.second) * (p.second));
  cout << count;
}
