keywords and a string text. Every character of text that belongs to at least one occurrence of some keyword must end up between the tags <b> and </b>. Occurrences may overlap.
Use as few tags as possible: highlighted pieces that overlap or sit right next to each other must be merged into a single piece with one pair of tags. Characters outside every occurrence stay outside the tags.
Return the resulting string.keywords=["sun", "set"], text="sunset over the sea" → '<b>sunset</b> over the sea'
The matches of sun and set touch each other, so a single pair of tags covers both.
keywords=["ana", "nab"], text="bananabread" → 'b<b>ananab</b>read'
ana occurs at positions 1 and 3, nab at position 4. Together they cover characters 1 through 6, which is one highlighted piece.
keywords=["tea"], text="coffee" → 'coffee'
The keyword never occurs, so the text comes back unchanged.
text consists of lowercase English letters and spaces; keywords[i] consists of lowercase English letterskeywords=["sun", "set"], text="sunset over the sea"
'<b>sunset</b> over the sea'
Run checks the first 3 tests in your browser. Submit checks all 132 tests on the server, hidden ones included.