Java Simple Approach O(n) Time, O(1) Space
If next character is same increase the current counter. Else reset the current counter to 1 when a different character is encountered. \n\nclass Solution {\n   
If next character is same increase the current counter. Else reset the current counter to 1 when a different character is encountered. \n```\nclass Solution {\n    public int maxPower(String s) {\n        int len=s.length();\n        int count =0;\n        int curr=1;\n        for(int i=0;i<len;i++){\n            if(i<len-1 &&s.charAt(i) == s.charAt(i+1)){\n                curr++;\n            }\n            else{\n                if(curr>count){\n                    count = curr;\n                }\n                curr=1;\n            }\n        }    \n        return count;   \n    }\n```\n}
['Java']