#include #include #include using namespace std; using namespace atcoder; using mint = modint998244353; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf32 1000000001 #define Inf64 4000000000000000001 int main(){ string s; cin>>s; map mp; long long ans = 0; rep(i,s.size()){ long long t = mp[s[i]]; mp[s[i]]++; t *= s.size()-1-i; ans += t; } for(auto x:mp){ long long t = x.second; t *= x.second-1; t *= x.second-2; t /= 6; ans -= t; } cout<