# 求字符串连续出现最多的字符和个数

const find = str => {
  const arr = str.match(/(\w)\1*/g)
  // [
  //   'aaa',      'bbbb',
  //   'cccccccc', 'dd',
  //   'o',        'i',
  //   'j',        'i',
  //   'j',        'd',
  //   'e',        'd',
  //   'e',        'ff',
  //   'e'
  // ]
  const maxLen = Math.max(...arr.map(s => s.length)) // 8
  const result = arr.filter(item => item.length === maxLen)[0] // cccccccc
  return { [result[0]]: result.length } // { c: 8 }
}
console.log(find('aaabbbbccccccccddoijijdedeffe')) // { c: 8 }