#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;
const ll Mod = 998244353;
const int MAX = 510000;
const double PI = 3.14159265358979;
const vector<int> dx = {1, 0};
const vector<int> dy = {0, 1};

int main() {
  string A;
  cin >> A;
  map<char, ll> z;
  for (int i=0; i<(int)A.size(); i++) {
    if (z.count(A[i])) z[A[i]]++;
    else z[A[i]] = 1;
  }
  ll num = 0;
  for (auto p: z) {
    auto value = p.second;
    num += value*(value-1)/2;
  }
  cout << (ll)A.size()*(A.size()-1)/2-num+1 << endl;
  return 0;
}
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ss(x) (int) x.size()
#define cat(x) cerr << #x << " = " << x << endl
#define rep(i, l, r) for (int i = l; i <= r; ++i)
#define per(i, l, r) for (int i = r; l <= i; --i)

using ll = long long;
using namespace std;

string s;
int cnt[26];
 
int main() {
	cin >> s;
	for (auto x : s)
		cnt[x - 'a']++;
	ll res = 0;
	rep(i, 0, 25)
		rep(j, i + 1, 25)
			res += 1LL * cnt[i] * cnt[j];
	cout << res + 1 << endl;
	return 0;
}
