Draft saved on this device
▤ Description
Core C++Easy
Compute Word Frequencies With Unordered Map
Count how many times each input word occurs.
Count how many times each input word occurs. Print each distinct word and its frequency in lexicographic (ascending) order. Words contain lowercase ASCII letters only; comparisons are case-sensitive.
Input format
First line N; next N whitespace-delimited words.
Output format
One line per distinct word: word count, sorted lexicographically.
Examples
Example 1
Input
5 cat dog cat bird dog
Expected output
bird 1 cat 2 dog 2
Constraints
- 0 ≤ N ≤ 100000
- 1 ≤ each word length ≤ 50
Related concepts
This early-access exercise uses standard input/output. More advanced concurrency challenges will use specialized class interfaces, instrumentation, and stress tests once the judging infrastructure is ready.
⌘ Code
Loading Monaco C++ editor…
Checking judge...
Checking whether the external C++ judge is available.
⌁ Test cases & resultsPublic samples: 1
Input
5 cat dog cat bird dog
Expected output
bird 1 cat 2 dog 2