For example, if I had a list that said
blue
blue
blue
red
red
green
green
green

it would output

blue 3
red 2
green 3