Given a string, write a python program to count the number of words in the string.
This is a test string
def count_words(string):
    words = string.split(" ")
    num_words = len(words)
    return num_words

result = count_words("This is a test string")
print("Number of words:", result)