#include <fstream>
#include <iostream>
#include <functional>
#include <algorithm>
#include <sstream>
#include <cstring>
#include <vector>
#include <string>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <deque>
#include <ctime>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <cassert>
//#include <unordered_map>
//#include <unordered_set>
using namespace std;
 
typedef long long ll;
#define eps 1e-8
#define LL_INF 0x3fffffffffffffff
#define INF 0x3f3f3f3f
#define mem(a, b) memset(a, b, sizeof(a))
#define pper(i,n,m) for(int i = n;i >= m; i--)
#define repp(i, n, m) for (int i = n; i <= m; i++)
#define rep(i, n, m) for (int i = n; i < m; i++)
#define sa(n) scanf("%d", &(n))
#define mp make_pair
#define ff first
#define ss second
#define pb push_back
#define DE(val) cout<<#val<<": "<<val<<endl;
 
const int dx44[5] = { 0,-1,-1,1,1 };
const int dy44[5] = { 0,-1,1,-1,1 };
 
const int dx4[5] = { 0,-1,0,1,0 };
const int dy4[5] = { 0,0,1,0,-1 };
const int dx8[9] = { 0,-1,0,1,0,1,1,-1,-1 };
const int dy8[9] = { 0,0,1,0,-1,1,-1,1,-1 };
const int maxn = 3e5 + 5;
const double PI = acos(-1.0);
const ll mod = 1e9 + 7;
ll po(ll a, ll b, ll mod) { ll res = 1; a %= mod; for (; b; b >>= 1) { if (b & 1)res = res*a%mod; a = a*a%mod; }return res; }
ll gcd(ll a, ll b) { if (a == 0) { return b; } else { return gcd(b%a, a); } }
void YES() { puts("YES"); exit(0); }
void Yes() { puts("Yes");}// exit(0); }
void NO() { puts("NO"); exit(0); }
void No() { puts("No");}// exit(0); }
void one() { puts("-1"); exit(0); }
 
 
string Manacher(string s) 
{
	ll le=s.length();
	ll ans=le*(le+1)/2;
    DE(le)
    // Insert '#'
    string t = "$#";
    for (int i = 0; i < s.size(); ++i) {
        t += s[i];
        t += "#";
    }
    // Process t
    ll cnt=0;
    vector<int> p(t.size(), 0);
    int mx = 0, id = 0, resLen = 0, resCenter = 0;
    for (int i = 1; i < t.size(); ++i) {
        p[i] = mx > i ? min(p[2 * id - i], mx - i) : 1;
        while (t[i + p[i]] == t[i - p[i]]) ++p[i];
        if (mx < i + p[i]) {
            mx = i + p[i];
            id = i;
        }
        if (resLen < p[i]) {
            resLen = p[i];
            resCenter = i;
        }
        if(i&1)
        {
        	cnt+=max(0,(p[i])/2);
        }
        else
        {
			cnt+=max(0,(p[i]+1)/2);
        }
        //cnt+=max(0,(p[i]-1)/2);
    }
    DE(ans)
    DE(cnt)
    cout<<ans-cnt+1<<endl;
    return s.substr((resCenter - resLen) / 2, resLen - 1);
}
 
string x;
 
void solve()
{
	cin>>x;
	Manacher(x);
}
 
string k[20][20];
void test()
{
	cin>>x;
	for(int i=0;i<x.length();i++)
	{
		for(int j=i+1;j<x.length();j++)
		{
			string tmp = x;
			reverse(tmp.begin()+i,tmp.begin()+j+1);
			if(tmp==x)
			{
				//cout<<i<<" "<<j<<endl;
			}
			for(int k1=0;k1<x.length();k1++)
			{
				for(int k2=0;k2<x.length();k2++)
				{
					if(tmp==k[k1][k2])
					{
						cout<<i<<" "<<j <<" "<<k1<<" "<<k2<<endl;
					}
				}
			}
			k[i][j]=tmp;
		}
	}
}
 
char val[maxn];
void solve2()
{
	scanf("%s",val+1);
	int len=strlen(val+1);
	ll ans=1LL*len*(len-1)/2;
	map<char,int>hax;
	repp(i,1,len)
	{
		ans-=hax[val[i]];
		hax[val[i]]++;
	}
	cout<<ans+1<<endl;
}
 
int main()
{
	solve2();
	// system("pause");
	return 0;
}

Measured memory_bytes: 512