
Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
There are two cases: a block of characters, or two blocks of characters between one different character. By keeping a run-length encoded version of the string, we can easily check these cases.