/**
* @param {string} word
* @return {number}
*/
var longestBeautifulSubstring = function (word) {
//直接比较字符串大小
let cLen = 1
let volOfClass = 1
let res = 0
for (let i = 1; i < word.length; i++) {
// 计数满足条件
if (word[i] >= word[i - 1]) cLen++;
// 用于跳出循环判断够不够五个字符
if (word[i] > word[i - 1]) volOfClass++;
// 不符合就重新计数
if (word[i] < word[i - 1]) { cLen = 1; volOfClass = 1 };
// 取最大的值
if (volOfClass === 5) { res = Math.max(cLen, res) };
}
return res
};