Simple javascript solution - 159 ms
\nvar repeatLimitedString = function(s, repeatLimit) {\n    const aCode = "a".charCodeAt();\n    const counts = new Array(26).fill(0);\n    let result = "";\n  
```\nvar repeatLimitedString = function(s, repeatLimit) {\n    const aCode = "a".charCodeAt();\n    const counts = new Array(26).fill(0);\n    let result = "";\n    let cnt, takeOne, len, lastLetter;\n    \n    for (let i = 0; i < s.length; ++i) {\n        ++counts[s.charCodeAt(i) - aCode];\n    }\n    \n    while (result.length < s.length) {\n        takeOne = false;\n        len = result.length;\n\n        for (let i = 26; i >= 0; --i) {\n            if (counts[i] > 0) {\n                \n                if (lastLetter === i) {\n                    takeOne = true;\n                    continue;\n                }\n                \n                lastLetter = i;\n                cnt = takeOne ? 1 : Math.min(counts[i], repeatLimit);\n                result += String.fromCharCode(i + aCode).repeat(cnt);\n                counts[i] -= cnt;\n                break;\n            }\n        }\n        \n        if (result.length === len) break;\n    }\n    \n    return result;\n};\n```
[]