#include <iostream>
using namespace std;
int chars[27] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
bool hasValidData = true;
int output=0;
int main() {
while (hasValidData) {
char in = '';
cin >> in;
int i = (int)i - (int)'A';
if (i <= 27 && i >= 0) {
chars[i]++;
}
else {
hasValidData = false;
}
}
for (int k = 0; k <= 27; k++)
{
int A = chars[k];
if ((A / 2) * 2 == A) {
output += (A + 1)*(A / 2);
}
else {
output += A*((A / 2) + 1);
}
}
cout << output;
return 0;
}