#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 1;
long long a[N];
void solve() {
  string s;
  cin >> s;
  int len = s.size();
  for (int i = 0; i < len; i++) a[s[i]]++;
  long long sum = 0;
  for (auto e : a) sum += e * e;
  cout << sum << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int t = 1;
  while (t-- > 0) solve();
  return 0;
}
