function solution(number, k) {
let index = k;
const arr = [];
for(let i=0; i<number.length; i++) {
const currentNumber = number[i];
while(index > 0 && (arr[arr.length -1] < currentNumber)) {
arr.pop();
index--;
}
arr.push(currentNumber);
}
const result = arr.join("").slice(0,k);
return result;
}