int@N,d[5],a=0;string@S;rep_scomb(d,5,N){a+=S[*d]==S[d[2]]&&set{{S[*d],S[d[1]],S[d[2]],S[d[3]],S[d[4]]}}.size()>3;}wt(a);