function solution(skill, skill_trees) {
let answer = 0;
const skillArr = skill.split('');
for (let tree of skill_trees) {
let idxArr = [];
let cnt = 0;
for (let i=0; i<tree.length; i++) {
if (skillArr.includes(tree[i])) idxArr.push([tree[i], cnt++]);
}
let flag = true;
for (let [s, idx] of idxArr) {
if (s !== skillArr[idx]) {
flag = false;
break;
}
}
if (flag) answer++;
}
return answer;
}