Simple java - 5 lines - O(n) time and O(1) space
\n    public int maxPower(String s) {\n        int res = 0, n = s.length();\n        for(int i=0; i<n; i++){\n            int j = i;\n\t\t\twhile(i+1 < n && s.c
```\n    public int maxPower(String s) {\n        int res = 0, n = s.length();\n        for(int i=0; i<n; i++){\n            int j = i;\n\t\t\twhile(i+1 < n && s.charAt(i) == s.charAt(i+1)) {i++;}  \n            res = Math.max(i-j+1, res);\n        }\n        return res;\n    }\n```
[]