#include <bits/stdc++.h>
using namespace std;

int main(){
	string A;
	cin >> A;
	int N=A.size();
	
	long long ans=(long long)N*(N-1)/2+1;
	for(int i=0;i<26;i++){
		char t='a'+i;
		int c=0;
		for(auto a:A)if(a==t)c++;
		ans-=(long long)c*(c-1)/2;
	}
	cout << ans << endl;
	return 0;
}