StateCount function for strings

Hi everyone,

Is there some function like StateCount that counts the repeated without having to put the text we are looking for?

I mean, when you use the StateCount function you have to define the value you looking for:

|> stateCount(fn: (r) => r._value < 10)

Imagine I have the next values:

john
john
marcus
alphonse
alphonse
alphonse
charles
charles

How do I get only the next result

john 0
john 1
marcus 0
alphonse 0
alphonse 1
alphonse 2
charles 0
charles 1

Thanks for helping.