(hometask from Java course)
Implement class that counts word frequencies in a string.