unittest
{
	assert( [ "aatt" ].parse.expand.solve == 5 );
	assert( [ "xxxxxxxxxx" ].parse.expand.solve == 1 );
	assert( [ "abracadabra" ].parse.expand.solve == 44 );
}



import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto as = input.front.to!( dchar[] );
	return tuple( as );
}

auto solve( dchar[] as )
{
	auto ans = 1L;
	auto cs = new long[ 26 ];
	auto ct = 0L;
	foreach( a; as )
	{
		auto i = a - 'a';
		ans += ct - cs[ i ];
		cs[ i ]++;
		ct++;
	}
	return ans;
}
