#include <bits/stdc++.h>
using namespace std;
int main() {
  long long hash[200006] = {0};
  long long ans = 0;
  string s1;
  cin >> s1;
  for (long long i = 0; i < s1.length(); i++) hash[s1[i] - '0']++;
  for (long long i = 0; i < 1000; i++) {
    ans += hash[i] * hash[i];
  }
  cout << ans;
}
