Back to problems

Word Frequency Counter

Algorithm · Citadel · Easy

Count Word Occurrences Easy · Hash Table, String · · Implement a function word_frequency(text) that accepts a string and builds a mapping from each distinct token to the number of times it appears. A token is defined as a maximal sequence of non‑whitespace characters delimited by one or more whitespace characters (spaces, tabs, etc.). Comparisons are case‑sensitive – uppercase and lowercase letters are treated as different characters – and any punctuation that immediately…

Checking your access…