#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  map<char, long long> m;
  string s;
  cin >> s;
  for (int i = 0; i < s.length(); i++) m[s[i]]++;
  map<char, long long>::iterator it;
  long long ans = 0;
  for (it = m.begin(); it != m.end(); it++) {
    long long freq = (it->second);
    ans = ans + (freq * (freq - 1ll)) + (freq);
  }
  cout << ans << '\n';
}
