/** * @param {string}allowed * @param {string[]}words * @return {number} */ var countConsistentStrings = function (allowed, words) { const allowedSet = newSet(allowed.split("")); let res = 0; for (const word of words) { let flag = true; for (const char of word) { if (!allowedSet.has(char)) { flag = false; break; } } if (flag) res++; } return res; };