2025-08-03 13:25:11 +0300 MSK
Consecutive Characters
Links
Code
class Solution:
def maxPower(self, s: str) -> int:
prev = s[0]
count = 1
max_count= 1
for char in s[1:]:
if char == prev:
count += 1
max_count = max(max_count, count)
else:
count = 1
prev = char
return max_count