foreach sentence in the file { ... foreach word in the sentence { ... foreach sentence in the file { ... # given n sentences with and avereage of m words each, # this block has to execute n*m*n times } } }