#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[507] = {0};
  string s;
  cin >> s;
  unsigned long long sum = 0;
  for (int i = 0; i <= s.size() - 1; ++i) a[s[i]]++;
  for (int i = 0; i <= 500; ++i) {
    sum += a[i];
    if (a[i] > 0) {
      long long x = a[i] - 1;
      sum += (x * (x + 1));
    }
  }
  cout << sum << endl;
}
