Mint a[26],b[26];string s;{rd(s);for(ll c:s){c-=97;a[c]+=a[c]+1;b[c]+=b[c]+1;rep(i,26)if(i-c)a[c]+=a[i],b[c]+=b[i]+a[i];}wt(sum(b(26)));}