[Java] O(n) time O(1) space
```\nclass Solution {\n    public int maxPower(String s) {\n        int n = s.length();\n        int start = 0, end = 0, max = 0;\n        while(end < n) {\n   
```\nclass Solution {\n    public int maxPower(String s) {\n        int n = s.length();\n        int start = 0, end = 0, max = 0;\n        while(end < n) {\n            while(end < n && s.charAt(end) == s.charAt(start)) {\n                max = Math.max(max, end - start + 1);\n                end++;\n            }\n            if(end == n) return max;\n            start = end;\n        }\n        return max;\n    }\n}
[]