refactored word-count ruby