yes. the problem is that I don’t do homework, not my own and certainly not someone else’s. and this is some form of homework, or test, with a rigid and arbitrary requirement. why? because what you are asking for is, IMO, not something that solves a problem in the real world. so let’s say there is a word file that exists with 3 words:  cat dog tree and a sentence file with 6 sentences: 1. The cat ate the dog. 2. The dog ate the tree. 3.