← Back to problems

34. Word Frequency Counter

EASY
CountingEasyHASH MAPLLD

Count occurrences of words in a stream and answer per-word count and distinct-word queries.

Count words as they arrive. Process commands from stdin, one per line. Commands: - ADD <word> : record one occurrence of <word>. - COUNT <word> : print how many times <word> has been recorded (0 if never). - DISTINCT : print the number of distinct words recorded so far. Words are single tokens with no spaces and are case-sensitive.
Log in to submit a solution

Comments

Log into join the discussion.