[Java/Python 3] Simple code w/ brief explanation and analysis.
Increase the counter by 1 if current char same as the previous one; otherwise, reset the counter to 1;\n2. Update the max value of the counter during each itera
1. Increase the counter by 1 if current char same as the previous one; otherwise, reset the counter to 1;\n2. Update the max value of the counter during each iteration.\n\n```java\n    public int maxPower(String s) {\n        int ans = 1;\n        for (int i = 1, cnt = 1; i < s.length(); ++i) {\n            if (s.charAt(i) == s.charAt(i - 1)) {\n                if (++cnt > ans) {\n                    ans = cnt;\n                }\n            }else {\n                cnt = 1;\n            }\n        }\n        return ans;\n    }\n```\n```python\n    def maxPower(self, s: str) -> int:\n        cnt = ans = 1\n        for i in range(1, len(s)):\n            if s[i] == s[i - 1]:\n                cnt += 1\n                if cnt > ans:\n                    ans = cnt\n            else:\n                cnt = 1\n        return ans\n```\n\n**Analysis:**\nTime: O(n), Space: O(1), where n = s.length().
[]