#include <bits/stdc++.h>
using namespace std;
unsigned long long a[256];
int main() {
  char s[100005];
  cin.getline(s, 100005);
  int len = strlen(s);
  for (int i = 0; i < len; ++i) {
    ++a[(size_t)s[i]];
  }
  unsigned long long ans = 0LL;
  for (int i = 0; i < 256; ++i) {
    ans += a[i] * a[i];
  }
  cout << ans;
  return 0;
}
