#include <iostream>
#include <string>
#include <algorithm>
using std::cout;
using std::cin;
using std::string;
using std::count;
long main(long argc, char* argv[]) {
// take input
string input;
cin >> input;
// parse input
long chars[26] = {0}; // A -> 0, B -> 1 ... Z -> 25
for (int i = 0; i < 26; i++) {
chars[i] = count(input.begin(), input.end(), (char)(i+65));
}
// do the actual things
long sum = 0;
for (int i = 0; i < 26; i++) {
long p = 0;
if (chars[i] % 2 == 0) {
p = (chars[i] + 1) * (chars[i] / 2);
} else {
p = ((chars[i] + 1) * ((chars[i] - 1) / 2)) + ((chars[i] + 1) / 2);
}
sum += p;
}
// output
cout << sum << "\n";
return 0;
}