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

int main(){
	string s;
	cin >> s;
	map<int,int> a;
	LL n = s.size();
	LL ans = n*(n-1)/2;
	for(int i = 0; i < s.size(); i++){
		ans -= a[s[i]-'a'];
		a[s[i]-'a']++;
	}
	cout << ans + 1 << endl;
}
