#include <bits/stdc++.h>

using namespace std;

long long x[26];

int main() {
	string s;
	cin >> s;
	long long n = s.size(), ans = n * (n - 1) / 2 + 1;
	for (char c : s)
		x[c - 'a']++;
	for (int i = 0; i < 26; i++)
		ans -= x[i] * (x[i]- 1) / 2;
	cout << ans << '\n';
}