创建一个函数，统计一个给定字符串中每个单词出现的次数，并将结果以字典的形式返回。
text = "hello world hello cat dog cat dog"
```
def word_count(text):
    words = text.split()
    counts = {}
    for word in words:
        if word in counts:
            counts[word] += 1
        else:
            counts[word] = 1
    return counts
print(word_count("hello world hello cat dog cat dog"))
```
输出：{'hello': 2, 'world': 1, 'cat': 2, 'dog': 2}