1933. Check if String Is Decomposable Into Value-Equal Substrings
Содержание
class Solution:
def isDecomposable(self, s: str) -> bool:
cnt2 = 0
for _, g in groupby(s):
m = len(list(g))
if m % 3 == 1:
return False
cnt2 += m % 3 == 2
if cnt2 > 1:
return False
return cnt2 == 1