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