[easy understanding][c++]
\n//1.[faster than 99.52%]\nclass Solution {\npublic:\n    int maxPower(string s) {\n        if(s.size()<=1) return s.size();\n        int count=1,maxcount=1;\n
```\n//1.[faster than 99.52%]\nclass Solution {\npublic:\n    int maxPower(string s) {\n        if(s.size()<=1) return s.size();\n        int count=1,maxcount=1;\n        for(int i=0;i<s.size()-1;i++){\n            if(s[i]==s[i+1]) maxcount=max(maxcount,++count);\n            else{\n                count=1;\n            }\n        }\n        return maxcount;\n    }\n};\n//2.[runtime beats 86.08 %]\nclass Solution {\npublic:\n    int maxPower(string s) {\n        char c=s[0];\n        int count=1,maxcount=1;\n        for(int i=1;i<s.size();i++){\n            if(s[i]==c) count++;\n            else{\n                if(count>maxcount) maxcount=count;\n                count=1;\n                c=s[i];\n            }\n        }\n        if(count>maxcount) maxcount=count;\n        return maxcount;\n    }\n};\n```\n**Feel free to ask any question in the comment section.**\nI hope that you\'ve found the solution useful.\nIn that case, **please do upvote and encourage me** to on my quest to document all leetcode problems\uD83D\uDE03\nHappy Coding :)\n
['C', 'C++']