Solución
solution.tsTypeScript
function compressString(text: string): string {
let conteo = 0;
let newText = "";
for(let i =0 ; i<text.length;i++){
conteo++;
if(text[i]!=text[i+1]){
newText += `${text[i]}${conteo}`;
conteo =0 ;
}
}
return newText;
}
// No modificar: necesario para evaluar el resultado.
export { compressString };0respuestas