Solución
solution.tsTypeScript
function runLengthEncoding(text: string): string {
// Escribe tu solución aquí
let output: string = '';
const set: Set<string> = new Set(text);
set.forEach(letter => {
const length: number = text.split('').filter(l => l === letter).length;
output += `${length}${letter}`
});
return output;
}
// No modificar: necesario para evaluar el resultado.
export { runLengthEncoding };0respuestas