#include<cstdio>
char c[200005];
int n;
long long ans,t[26];
int main()
{
	scanf("%s",c);
	for(int i=0;c[i]!='\0';++i)++n,t[c[i]-'a']++;
	for(int i=0;i<26;++i)ans+=t[i]*(n-t[i]);
	printf("%lld\n",ans/2+1);
	return 0;
}