Get Mystery Box with random crypto!

#N1446. Consecutive Characters problem link #solution class S | Leetcode in Java && MySQL

#N1446. Consecutive Characters
problem link

#solution
class Solution {
public int maxPower(String s) {
if(s.length() == 1) return 1;
int count = 0, power = 0;
char temp = s.charAt(0);

for(char ch: s.toCharArray()){
if(temp == ch) count++;
else{
count = 1;
temp = ch;
}
power = Math.max(power, count);
}

return power;
}
}