I think it could be made to be cleaner by calling a function that determines
how many "of a kind" there are by passing arguments of how many "of a kind"
you are looking for. 2 of a kind, 3 of a kind, 4 of a kind etc.
My thinking was different in that I had to try to figure out what all the pieces were
doing as opposed to creating the logic myself.
Including comments helps remind me as well as helps other future users of my code.