#include <bits/stdc++.h>
using namespace std;
int main() {
  char str[100001];
  long long solv[256];
  for (int i = 0; i < 256; i++) solv[i] = 0;
  gets(str);
  long long len = strlen(str);
  if (len <= 1) {
    printf("1");
    return 0;
  }
  for (int i = 0; i < len; i++) {
    solv[str[i]]++;
  }
  long long sum = 0;
  for (int i = 0; i < 256; i++)
    if (solv[i] > 1) sum += (solv[i] * (solv[i] - 1));
  cout << sum + len;
  return 0;
}
