F#, score 120 118##118
let j z=Seq.countBy id z|>Seq.sumBy(fun x->List.sum[0..snd x])
-2 thanks to Kevin Cruijssen!
Takes a string as an input. Seq.countBy pairs each distinct character with its count (id is the identity function) so you end up with a collection like 'a' = 4, 'b' = 2 etc.
The Seq.sumBy takes the count for every letter and sums all the numbers from 0 to the count for that letter. So if 'a' = 4 the collection would be 0, 1, 2, 3, 4 which summed together is 10. Then Seq.sumBy sums all those totals.