[Ruby] What does this variable do here?

What does this variable do here ?

Rubocop wants the other variable ‘word’ to be used as well as ‘count’ , I don’t know what ‘count’ is doing there to begin with.

I have changed yuor title to include the language you are using, it is a good practice so that people know if they might be able to help you by just looking at the title.
If it’s wrong feel free to change it, but please think about this next time.