Practice · 2 of 5
Word Census
CHALLENGE
Difficulty: beginner+25 XP
**Description:** Read n words. Print each distinct word once, in **alphabetical**
order, followed by its count: word count per line.
**Input:** Line 1: n (1 <= n <= 10^5). Next n lines: one word each (lowercase
letters, <= 20 chars).
**Output:** One line per distinct word: word count.
**Example:** 4 / banana / apple / banana / cherry -> apple 1 / banana 2 / cherry 1.
Press Submit to check your solution.
Back to lesson: Practice: STL Problem Set