Word Counter (Maps & Dictionaries)

Read a line of words. For each distinct word, in the order it first appears, print word count.

Input: One line of lower-case words.

Output: One line per distinct word.

Difficulty: Easy. Write your answer in the browser editor, run the examples, then submit it against hidden tests. Python and JavaScript are free; other languages are part of licode Club.

Hint

  • A map from word to count. Keep a list of the order words first appeared.

More Maps & Dictionaries practice