function encode(arr){
let encodedStr='';
for(let x of arr){
encodedStr=encodedStr.concat(x.length,x);
}
console.log(encodedStr);
return encodedStr;
}
function decode(str){
const arr=[];
let wordLength=str[0];
for(let x=1; x<str.length; x++){
let word=''
while(wordLength--){
word+=str[x++];
}
arr.push(word);
wordLength=str[x]
}
console.log(arr)
return arr;
}
decode(encode(["p","oil","p9095o","123455"]));