Given 1TB of a file, how to check the word count using any language?
Implement count_words(chunks), where chunks is a list of string fragments read sequentially from the file. Return the number of whitespace-delimited words without loading the entire file into memory. A word may span multiple non-empty chunks, while whitespace and empty chunks end the current word.
0 <= len(chunks)isspace() returns True.def count_words(chunks):