#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  vector<long long> count(256, 0);
  cin >> s;
  for (size_t i = 0; i < s.length(); ++i) {
    ++count[s[i]];
  }
  long long ans = 0;
  for (int i = 0; i < 256; ++i) {
    ans += count[i] * count[i];
  }
  cout << ans << '\n';
  return 0;
}
