#include <bits/stdc++.h>
using namespace std;
string st;
map<char, long long> m;
long long ans;
int32_t main() {
  ios_base ::sync_with_stdio(false);
  cin >> st;
  for (auto &i : st) {
    ++m[i];
  }
  for (auto &i : m) {
    ans += i.second * i.second;
  }
  cout << ans;
}
