> I used string::find() in contains_word() to see if the word was there
The problem with using string::find() (as it has been used) is this:
if we try to list all the lines containing the word 'template',
lines containing the word 'contemplated' would also be part of the list.
If it interests you, try extending this so that if the word being searched for is "template", it would also match lines that contain words like "templates" or "templated".
Stemming: https://en.wikipedia.org/wiki/Stemming