#include #include #define rep(i,n) for(int i=0;i P; typedef vector vi; constexpr ll inf=1ll<<61; constexpr ll mod=998244353; typedef modint998244353 mi; vectorG[26]; int main(){ string s;cin>>s; ll ans=0; int n=s.size(); rep(i,n){ G[s[i]-'A'].push_back(i); } rep(i,26){ for(int j=0;j2)ans-=d*(d-1)*(d-2)/6; } cout<