File size: 197 Bytes
91f7972
 
 
 
 
 
58f6308
1
2
3
4
5
6
7
8
def word_count(text):
    """Count occurrences of words in text."""
    words = text.split()
    counts = {}
    for word in words:
        counts[word] = counts.get(word, 0) + 1
    return counts