给你一个由不同字符组成的字符串 allowed 和一个字符串数组 words 。如果一个字符串的每一个字符都在 allowed
中,就称这个字符串是 一致字符串 。
请你返回 words 数组中 一致字符串 的数目。
classSolution:defcountConsistentStrings(self, allowed:str, words: List[str])->int:
ans =0
allowed =set(allowed)for word in words:
word =set(word)if word <= allowed:
ans +=1return ans