#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <iomanip>
#include <stack>
#include <queue>
#include <deque>

using namespace std;

typedef long long ll;
typedef pair <int, int> pii;

#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()
#define pb push_back
#define ppb pop_back
#define mkp make_pair
#define F first
#define S second
#define show(a) cerr << #a <<" -> "<< a <<"\n"
#define fo(a, b, c ,d) for(int a = b; a <= c; a += d)
//#define int ll

const int N = 2e5;

string s;
ll ans = 1;
int cnt[N];

int main () {
	ios_base::sync_with_stdio(0);
	cin >> s;
	for(int i = 0; i < sz(s); ++i) {
		ans += i;
		ans -= cnt[(s[i] - 'a')]++;
	}
	cout << ans;
	return 0;
}