Count frequency of each word in a string. Example: "the cat the dog" => {"the":2,"cat":1,"dog":1}
Implement this function:
def word_frequency(s: str) -> dict:
Write the function only — the arguments are read for you and the return value is printed automatically.
Arguments arrive as one Python literal per line, in this order: s.
Input
'the cat the dog'
Output
{'the': 2, 'cat': 1, 'dog': 1}