/// sultanov

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
 
#include<x86intrin.h>
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
     
#define x first
#define y second
#define pb push_back
#define sz(x) (int) x.size()
 
using namespace std;
using namespace __gnu_pbds;

template<typename T> 
using ordered_set = tree<T, null_type,   
less<T>, rb_tree_tag,
tree_order_statistics_node_update>;

using ll = long long;
using pii = pair<int, int>;                                   

const int INF32 = 1e9;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);                
    string s;
    cin >> s;
    int sz = sz(s);
    map<char, int> cnt;
    for (char c : s)
        cnt[c]++;
    ll ans = 1;
    for (int i = 0; i < sz(s); i++) 
        ans += sz-- - cnt[s[i]]--;
    cout << ans;
    return false;                                                       
}