Given 1TB of a file, how to check the word count using any language?
Asked in the Panel interview stage. Implement a streaming word counter that processes successive text chunks and never loads the complete file into memory.
chunks is an iterable of strings representing consecutive file chunks. Return the number of whitespace-delimited words. A word may span multiple chunks, and any Unicode whitespace separates words.
def count_words(chunks):