function solution(s) {
var answer = s.length;
for(let i=1;i<=parseInt(s.length/2);i++){
let part=s.slice(0,i);
let count=1;
let str='';
for(let j=i;j<s.length;j+=i){
if(part===s.slice(j,j+i)){
count+=1;
}else{
str+=count>1?count+part:part;
count=1;
part=s.slice(j,j+i);
}
}
str+=count>1?count+part:part;
answer=Math.min(answer,str.length)
}
return answer;
}