#include using namespace std; typedef long long ll; int main(){ string S; cin >> S; int l = S.length(); ll ans=0; map ser; for(int i=0;i= 2){ int su = ser[c]; ll pl = su*(su-1)/2; ans += pl; } } ser[S[i]]++; } cout << ans << endl; }