☑️✅ 100/100 OPTIMIZED Code || Consecutive-characters || Easy Solutions
\n\n# Code\n\nclass Solution {\npublic:\n    int maxPower(string s) {\n        if(s.size()==1)return 1;\n        int maxi=INT_MIN;\n        for(int i=0;i<s.size
![wallpaperflare.com_wallpaper (4).jpg](https://assets.leetcode.com/users/images/54a852fa-dab5-4583-97c7-f7047d91cbbd_1715713761.0043914.jpeg)\n\n# Code\n```\nclass Solution {\npublic:\n    int maxPower(string s) {\n        if(s.size()==1)return 1;\n        int maxi=INT_MIN;\n        for(int i=0;i<s.size();){\n            int count=0;\n            int j=i;\n            while(s[i]==s[j] && j<s.size()){\n                count++;\n                j++;\n            }\n            maxi=max(count,maxi);\n            i=j;\n        }\n        return maxi;\n    }\n};\n```\n![14a3ceaa-fd34-46b0-a334-3b2395d99d77_1679831064.7105706.png](https://assets.leetcode.com/users/images/125157a5-6a27-4c91-811a-f446b438839c_1715713786.330781.png)\n
['String', 'C++']