输入:s = "leetcode"
输出:2
解释:子字符串 "ee" 长度为 2 ,只包含字符 'e' 。
输入:s = "triplepillooooow"
输出:5
var maxPower = function (s) {
var max = 1
var currentLength = 1
var index = 0;
var arr = s.split('');
while (index <= arr.length - 1) {
if (arr[index] === arr[index + 1]) {
currentLength++
if (currentLength > max) {
max = currentLength
}
} else {
currentLength = 1
}
index++
};
return max
};