#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>
#include <iomanip>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9 + 7);

int main(void) {
	string a;
	cin >> a;
	
	int n = (int)a.size();
	map<char, int> mp;
	
	for(int i = 0; i < n; ++i) {
		mp[a[i]]++;
	}
	
	ll ans = 1LL;
	for(int i = 0; i < n; ++i) {
		ans += n - i - 1 - (mp[a[i]] - 1);
		mp[a[i]]--;
	}
	
	cout << ans << endl;
	
	return 0;
}

#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define FORR(i, a, b) for (int i = b - 1; i >= a; --i)
#define SORT(v) sort(v.begin(), v.end())
#define SORTR(v) sort(v.rbegin(), v.rend())
#define REV(v) reverse(v.begin(), v.end())
#define ITER(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define LB(v, x) (lower_bound(v.begin(), v.end(), x) - v.begin())
#define UB(v, x) (upper_bound(v.begin(), v.end(), x) - v.begin())
#define SZ(v) (int)v.size()
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    string A;
    cin >> A;
    vector<ll> num_char(26);
    for (auto &c : A) {
        num_char[c - 'a']++;
    }
    ll res = 1;
    REP(i, 25) {
        FOR(j, i + 1, 26) {
            res += num_char[i] * num_char[j];
        }
    }
    cout << res << endl;

    return 0;
}
