def word_counter(sentence):
    """Counts the number of words in given sentence"""

    sentence = sentence.strip() #removes whitespace from beginning and end of sentence

    space_count = 0
    for char in sentence:
        #check if char is single space
        if char in '':
            space_count += 1

    word_count = space_count + 1

    return word_count