hname = input("Enter file name: ")
 
num_words = 0
 
with open(hname, 'r') as h:
    for line in h:
        words = line.split()
        num_words += len(words)
print("Number of words:")
print(num_words)