#include <bits/stdc++.h>
using namespace std;
void Weapons19() {
  cin.sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
int32_t main() {
  Weapons19();
  long long n;
  string s;
  cin >> s;
  map<char, long long> m;
  n = s.size();
  for (long long i = 0; i < n; i++) {
    m[s[i]]++;
  }
  long long ans = 0;
  for (auto a : m) {
    ans += a.second * a.second;
  }
  cout << ans;
}
