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