#include <bits/stdc++.h>
using namespace std;
long long characters[128];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  string s;
  cin >> s;
  for (int i = 0; i < s.size(); i++) characters[s[i]]++;
  long long ans = 0;
  for (int i = 0; i < 128; i++) ans += characters[i] * characters[i];
  cout << ans << "\n";
  return 0;
}
