Tally
Tally[list]
creates tallies of the elements in list
.
Attributes[Tally] := {Protected}
Simple examples
In[1]:= Tally[{a, a, b, b}]
Out[1]= {{a, 2}, {b, 2}}
In[2]:= Tally[{b, b, a, a}]
Out[2]= {{b, 2}, {a, 2}}
In[3]:= Tally[{b, b, a}]
Out[3]= {{b, 2}, {a, 1}}