1446. Consecutive Characters

Обновлено: 2024-03-12
1 мин
[]

Содержание

LeetCode problem 1446

class Solution:
    def maxPower(self, s: str) -> int:
        res = t = 1
        for a, b in pairwise(s):
            if a == b:
                t += 1
                res = max(res, t)
            else:
                t = 1
        return res