import std.algorithm;
import std.array;
import std.conv;
import std.stdio;
import std.string;

void main ()
{
	string a;
	while ((a = readln.strip) != "")
	{
		auto n = a.length.to !(int);
		int [char] w;
		foreach (c; a)
		{
			w[c] += 1;
		}
		auto res = 1 + (n * (n - 1L)) / 2;
		foreach (k, v; w)
		{
			res -= (v * (v - 1L)) / 2;
		}
		writeln (res);
	}
}
