#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  vector<long long> a(255, 0);
  for (int i = 0; i < s.size(); i++) a[s[i]]++;
  long long ans = 0;
  for (int i = 0; i < 255; i++)
    if (a[i] >= 1) ans += a[i] * a[i];
  cout << ans;
  return 0;
}
