1684. Count the Number of Consistent Strings
## 思路
先把allowed轉成set 再檢查每個word
## Code
```python
class Solution:
def countConsistentStrings(self, allowed: str, words: List[str]) -> int:
allowed = set(allowed)
res = len(words)
for word in words:
for ch in word:
if ch not in allowed:
res -= 1
break
return res
```
2506. Count Pairs Of Similar Strings
## 思路
hash table存相似字串的次數
key: 用bitmask 記錄字串包含的字元
## Code
```python
class Solution:
def similarPairs(self, words: List[str]) -> int:
count = defaultdict(int)
res = 0
for word in words:
mask = 0
for ch in word:
mask |= 1 << (ord(ch) - ord('a'))
res += count[mask]
count[mask] += 1
return res
```