#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  map<long long, long long> mp, mp2;
  long long ans = 0;
  string str;
  cin >> str;
  for (auto i : str) (i >= '0' && i <= '9') ? mp2[i - '0']++ : mp[i - 'a']++;
  for (long long i = 0; i < 26; i++) {
    if (mp[i]) ans += mp[i] + (mp[i] * (mp[i] - 1));
  }
  for (long long i = 0; i < 10; i++)
    if (mp2[i]) ans += mp2[i] + (mp2[i] * (mp2[i] - 1));
  cout << ans << endl;
  return 0;
}
