3 solutions in Python3 ✅✅✅ || Understandable and Beginner-Friendly
Code\n\nclass Solution:\n    def maxPower(self, s: str) -> int:\n        maximum = 0\n        count = 0\n        for i in range(1, len(s)):\n            if s[i 
# Code\n```\nclass Solution:\n    def maxPower(self, s: str) -> int:\n        maximum = 0\n        count = 0\n        for i in range(1, len(s)):\n            if s[i - 1] == s[i]:\n                count += 1\n                maximum = max(maximum, count)\n            else:\n                count = 0\n        return maximum + 1\n```\n\n![image.png](https://assets.leetcode.com/users/images/f2b26b89-b360-4f66-a977-66c63586716e_1671071777.3769999.png)\n![image.png](https://assets.leetcode.com/users/images/2807c7d8-100b-45b4-aece-f3412f4fe94e_1671071794.8311553.png)\n\n\n```\nclass Solution:\n    def maxPower(self, s: str) -> int:\n        maximum = 0\n        count = 0\n        for i in range(1, len(s)):\n            if len(set([s[i - 1], s[i]])) == 1:\n                count += 1\n                maximum = max(maximum, count)\n            else:\n                count = 0\n        return maximum + 1\n```\n\n![image.png](https://assets.leetcode.com/users/images/0b4a859e-fd44-40e1-8201-e1c9e71f0396_1671071882.0631535.png)\n\n\n```\nclass Solution:\n    def maxPower(self, s: str) -> int:\n        maximum = 0\n        count = 0\n        for i in range(1, len(s)):\n            if len(set([s[i - 1], s[i]])) == 1:\n                count += 1\n            else:\n                count = 0\n            maximum = max(maximum, count)\n        return maximum + 1\n```\n![image.png](https://assets.leetcode.com/users/images/51dbb3ab-b4be-48d9-99df-0d0547db093d_1671072450.9201818.png)\n![image.png](https://assets.leetcode.com/users/images/33ee9092-ed52-4845-bc7f-687a9005dc6e_1671072495.3237548.png)\n\n
['String', 'Python3']