Java O(n) loops
\npublic int maxPower(String s) {\n        if (s == null || s.length() == 0) return 0;\n        int res = 0, i = 0, n = s.length();\n        while (i < n) {\n  
```\npublic int maxPower(String s) {\n        if (s == null || s.length() == 0) return 0;\n        int res = 0, i = 0, n = s.length();\n        while (i < n) {\n            int r = i;\n            while (r + 1 < n && s.charAt(r + 1) == s.charAt(r)) r++;\n            res = Math.max(res, r - i + 1);\n            i = r + 1;\n        }\n        return res;\n    }\n```
[]