bold
with the same length as s
, with all values set to false
.word
in words
, find all occurrences in s
and mark the corresponding characters in bold
as true
.s
and build the result string. If bold[i]
is true
and bold[i - 1]
is false
, insert <b>
before s[i]
. If bold[i]
is true
and bold[i + 1]
is false
, insert </b>
after s[i]
.