1446. Consecutive Characters

Updated: 2024-03-12
1 min read
[]

On This Page

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