Given two documents:
Now is the winter of our discontent Made glorious summer by this sun of York; And all the clouds that lour'd upon our house In the deep bosom of the ocean buried. Now are our brows bound with victorious wreaths; Our bruised arms hung up for monuments; Our stern alarums changed to merry meetings, Our dreadful marches to delightful measures.
(Richard III)
Richard (Duke of York): [bangs his goblet thrice on the table] Silence! Silence! For the king!
King (Richard III): [stands, hunched, speaks awkwardly] Now is the summer of our sweet content, [Made?] [err?]-cast winter by these Tudor clouds.
(BlackAdder, Season 1, Episode 1)
What sort of algorithm could someone use to find out which 3-word sequences exist in both documents? If there are any, of course - it's not guaranteed.
In this example, "now is the" is the only 3-word sequence that appears in both documents.