#include <bits/stdc++.h>
#define boost ios_base::sync_with_stdio(false), cin.tie(NULL);

using namespace std;
const int N = 2e5 + 4;
const int X[] = {1,0,-1,0,1,-1,1,-1};
const int Y[] = {0,1,0,-1,1,1,-1,-1};
const int mod = 1e9 + 7;
const long long INF = 1e18;
const int inf = 1e9;

map <char, int> mp;

int main () {
	boost;
	string s;
	cin >> s;
	long long ans = 0;
	int n = s.size();
	for (int i = 0 ; i < n ; ++ i) {
		ans += i - mp[s[i]];
		mp[s[i]]++;
	}
	cout << ans + 1;
}