Nice solution, Monks. Thanks a lot.
Hi Kyle,
I am trying to understand the procedure of your method. I observe that the phrases that get marked in the sentence depend on their order in the array 'phrases'. The sentence is scanned from left to right and wherever it finds a match 'first' in the array order of phrases it selects that phrase. So, in case of an overlap, the phrase that appears first in the 'phrases' array is given the priority.
Please correct me if I am wrong.
Thanks.