Loading...
Given a string of text, split it into lowercase words (splitting on whitespace), and return a dictionary mapping each word to its frequency count.
Words should be converted to lowercase before counting. The output dictionary should be printed with keys in sorted order.
Example:
The cat sat on the mat
{'cat': 1, 'mat': 1, 'on': 1, 'sat': 1, 'the': 2}Step 1: Lowercase the text "The cat sat on the mat" becomes "the cat sat on the mat"
Step 2: Split into words ["the", "cat", "sat", "on", "the", "mat"]
Step 3: Count frequencies
Step 4: Sort by key and output {'cat': 1, 'mat': 1, 'on': 1, 'sat': 1, 'the': 2}