c++ simple solution
C++ simple solution\n This problem is similar to counting consecutive 1\'s.\n In this problem if all the characters are unique, we\'ll have to return 1.\n Also,
# **C++ simple solution**\n* This problem is similar to counting consecutive 1\'s.\n* In this problem if all the characters are unique, we\'ll have to return 1.\n* Also, keep the *longestcount* set to 1, so that whenever you get a match with another character, you can increment the *longestcount* and it becomes 2.\n* Keep track of the longest_count in *ans* and return *ans*\n\n```\nclass Solution {\npublic:\n    int maxPower(string s) {\n        int ans = 1;\n        int longest_count = 1;\n        for(int i = 1; i < s.length(); i++){\n            if(s[i] == s[i-1]){\n                longest_count++;\n                ans = max(ans, longest_count);\n            }\n            else{\n                longest_count = 1;\n            }\n        }\n        return ans;\n    }\n};\n```
[]