Word frequency
mediumDictionaries20 XP
Words in text are separated by spaces (possibly several). Return a dictionary (JavaScript: object) mapping each word, in lower case, to how many times it appears.
Examples
- Input: text = "The cat and the hat"Output: {"the": 2, "cat": 1, "and": 1, "hat": 1}
- Input: text = ""Output: {}
Examples use JSON: true/false/null are True/False/None in Python.