Home / Challenges / Word Frequency Counter

Word Frequency Counter

Medium
Write a function word_frequency(text) that takes a string and returns a dictionary mapping each word (lowercase) to the number of times it appears.

Input

A string of space-separated words.

Output

A dictionary {word: count, ...}.

Example

Input
"apple banana apple orange banana apple"
Output
{'apple': 3, 'banana': 2, 'orange': 1}
15 XP on solve Back to lesson

Your Solution

Output
Click "Run" to execute your code...

Log in to submit your solution and earn XP.