#include <bits/stdc++.h>
using namespace std;
void shoot() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
int main() {
  shoot();
  long long i, n, sum = 0;
  long long hash[301];
  string s;
  memset(hash, 0, sizeof(hash));
  cin >> s;
  n = s.size();
  for (i = 0; i < n; i++) {
    hash[(int)s[i]]++;
  }
  sum = n;
  for (i = 0; i <= 300; i++) {
    sum += hash[i] * (hash[i] - 1);
  }
  cout << sum;
  return 0;
}
