text of lowercase English letters and an integer length. Check whether the string contains a block of exactly length identical letters in a row that cannot be extended: the letter before the block (if any) and the letter after it (if any) both differ from the block's letter.
Return True if such a block exists and False otherwise.text='bbbxbbbb', length=3 → True
The first three b's form a run of exactly three: nothing stands before them and an "x" follows.
text='qqqq', length=2 → False
Any two q's here touch another "q", so there is no standalone block of length 2.
text='tree', length=1 → True
length ≤ len(text) ≤ 100text consists of lowercase English letterstext='bbbxbbbb', length=3
True
Run checks the first 3 tests in your browser. Submit checks all 114 tests on the server, hidden ones included.