#include <bits/stdc++.h>
using namespace std;
string s;
long long a[28] = {0};
long long b[11] = {0};
int main() {
  cin >> s;
  for (int i = 0; i < s.length(); ++i) {
    if (s[i] >= 'a' && s[i] <= 'z') a[s[i] - 'a'] += 1;
  }
  for (int i = 0; i < s.length(); ++i) {
    if (s[i] >= '0' && s[i] <= '9') b[s[i] - '0'] += 1;
  }
  unsigned long long ans = 0;
  for (int i = 0; i < 26; i++) {
    if (a[i] == 0) continue;
    ans += a[i] * a[i] * 1LL;
  }
  for (int i = 0; i < 10; i++) {
    if (b[i] == 0) continue;
    ans += b[i] * b[i] * 1LL;
  }
  cout << ans << endl;
  return 0;
}
