class Solution:
def maxProduct(self, words: List[str]) -> int:
d = {}
for w in words:
mask = 0
for c in set(w):
mask |= (1 << (ord(c) - 97))
d[mask] = max(d.get(mask, 0), len(w))
return max([d[x] * d[y] for x in d for y in d if not x & y] or [0])