#include <bits/stdc++.h>
using namespace std;
int freq[300];
int main() {
  string a;
  cin >> a;
  for (auto v : a) freq[(int)v]++;
  long long ans = a.size();
  for (int i = 0; i < 300; i++)
    ans += (long long)freq[i] * (long long)(freq[i] - 1ll);
  cout << ans << endl;
}
