Beats 100% by simple if and else 
Complexity- Time complexity: O(N)- Space complexity: O(1)Code


# Complexity
# - Time complexity: O(N)
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

# - Space complexity: O(1)
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```cpp []
class Solution {
public:
    int maxPower(string s) {
      int ans = 1;
      int maxx = 1;
      char d;
      for(int i = 1; i<s.size() ; i++){
        d = s[i];
        if(s[i-1] == d){
            ans++;
            maxx = max(ans,maxx);
        }else{
            ans = 1;
        }
      }
      return maxx;  
    }
};
```
['String', 'C++']