function solution(s) {
let answer = [0, 0];
// 5
while (s !== "1") {
// 1
const prevLen = s.length;
// 2
s = s.replace(/0/g, "");
// 3
const curLen = s.length;
// 4
s = curLen.toString(2);
answer[1] += prevLen - curLen;
answer[0] += 1;
}
return answer;
}