#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  map<char, int> M;
  for (char ch : s) {
    M[ch]++;
  }
  long long ans = 0;
  for (char ch : s) {
    ans += M[ch];
  }
  cout << ans << endl;
  return 0;
}
