You are stripping spaces from the ends, not splitting the words. You are counting the remaining characters now, not words.
Use str.split() instead:
words = len(line.split())
No arguments required, or use None
; it'll strip whitespace from the ends, and split on arbitrary-width whitespace, giving you words:
>>> 'it may work'.split()
['it', 'may', 'work']
>>> len('it may work'.split())
3