words
를 알파벳 단위로 분리words
를 순회allowed
에 포함되었는지 검증function countConsistentStrings(allowed: string, words: string[]): number {
const wordSplitted = words.map(a => [...a])
const consisted = wordSplitted.reduce((acc, cur) => {
const includes = cur.every(a => allowed.includes(a))
return acc + Number(includes)
}, 0)
return consisted
};