text of lowercase English letters. Edits are then applied to it one after another: edit number i writes the letter letters[i] at position positions[i] (0-based), replacing whatever letter was there. Edits stack up: each one applies to the text as the previous edits left it.
A *run* is a stretch of consecutive equal letters. After each edit, find the length of the longest run anywhere in the text.
Return the list of those lengths, one per edit, in order.text="xxyzz", letters="zyz", positions=[2, 1, 1] → [3, 3, 4]
After the first edit the text is xxzzz and the longest run is zzz, length 3. After the second it is xyzzz, still 3. After the third it is xzzzz, a run of four z.
text="aaaa", letters="b", positions=[1] → [2]
The text becomes abaa, and the longest run is the two a at the end.
text="q", letters="qr", positions=[0, 0] → [1, 1]
The first edit writes the same letter and changes nothing, the second replaces the only letter. Either way the run has length 1.
text) ≤ 10⁵letters) ≤ 10⁵positions) = len(letters)positions[i] < len(text)text and letters consist of lowercase English letterstext="xxyzz", letters="zyz", positions=[2, 1, 1]
[3, 3, 4]
Run checks the first 3 tests in your browser. Submit checks all 72 tests on the server, hidden ones included.