Step-by-step solution for Letter Count I
View the challenge

This challenge requires you to determine which word has the greatest number of repeated characters in a string, and return that word. For example, in the string "coderbyte is cool" your program should return the word "coderbyte" because it has 2 e's. If no word in the string has repeated characters, then your program should return -1. To solve this challenge, we'll loop through each word in the string, storing the current character and the number of times it has occurred so far. We'll use an object-type data structure that will help us keep track of the word, its characters, and the counts.

You need to be a member to see the rest of this solution and code.