Skip to main content

Practice · 2 of 3

Unique words and their counts

CHALLENGE
Difficulty: beginner+25 XP

Implement static int distinctWords(String sentence) (whitespace-split, case-insensitive) and static java.util.Map<String, Integer> wordCounts(String sentence) mapping each lowercase word to its count.

Back to lesson: Practice: Practice: Collections at Work