Write a program to count the number of words in a string.
Implement count_words(text), which accepts one string and returns an integer. A word is a maximal sequence of non-whitespace characters. Treat spaces, tabs, and newline characters as separators, ignore leading or trailing separators, and treat consecutive separators as one. Test inputs may represent tab and newline separators using the escaped sequences \\t and \ .
def count_words(text):