text against a list of banned letter sequences banned. A stretch of the message (a run of consecutive characters) is **clean** if no sequence from banned appears entirely inside it.
Return the length of the longest clean stretch. The empty stretch counts as clean, so the answer can be 0.text="moonbeam", banned=["oo", "ea"] → 4
The stretch onbe is clean: extending it left would add oo, extending it right would add ea. Nothing longer avoids both, so the answer is 4.
text="aaaa", banned=["a"] → 0
The letter a itself is banned, so only the empty piece is clean.
text="river", banned=["xyz"] → 5
The banned word never appears, so the whole text works.
text and every banned[i] consist of lowercase English letterstext="moonbeam", banned=["oo", "ea"]
4
Run checks the first 3 tests in your browser. Submit checks all 78 tests on the server, hidden ones included.