js findMaxDepulicateChar
function findMaxDepulicateChar(str) { var obj = {}; for (let i = 0, len = str.length; i < len; i++) { if (!obj[str[i]]) { obj[str[i]] = 1; } else { obj[str[i]] += 1; } } var maxChar = ''; var max = 0; for (var key in obj) { if (obj[key] > max) { max = obj[key]; maxChar = key; } } return ('maxChar:' + maxChar + ' sum:' + max); } var str = 'aaaaddddddddfddfdhjjjjjjgdsbsdheldhfld'; console.log(findMaxDepulicateChar(str)); // maxChar:d sum:15