#include <iostream>
#include <string>
int main()
{
char* input = new char[ 100001 ];
std::cin.getline( input, 100001, '\n' );
unsigned long long length = strlen( input );
unsigned long long output = 0;
unsigned long long characterCounts[ 26 ];
for ( int i = 0; i < 26; ++i )
{
characterCounts[i] = 0;
}
for ( int i = 0; i < length; ++i )
{
characterCounts[ input[ i ] - 'A' ]++;
}
for ( int i = 0; i < 26; ++i )
{
int count = characterCounts[ i ];
output += ( count * (count + 1) ) / 2;
}
std::cout << output << "\n";
delete[] input;
return 0;
}