[C++] | O(n) | simple logic | detail explanation
logic : take a character as pivot and check next characters\n\nint maxPower(string s) {\n       int ma=0,j=0;\n        while(1){\n            int z=0;char c=s[j
logic : take a character as pivot and check next characters\n```\nint maxPower(string s) {\n       int ma=0,j=0;\n        while(1){\n            int z=0;char c=s[j];\n\t\t//if that character is repeating just count it\n            while(s[j]==c){\n                z++;j++;\n                if(j==s.length())break;\n            }\n\t\t//check if new count is the maximum or not\n            ma=max(ma,z);\n            if(j==s.length())break;\n        }\n        return ma;\n    }\n```\nthank you | please upvote
[]