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