2
def distinctNames(self, ideas: List[str]) -> int:4
names = defaultdict(set)7
# to store first letter as key and followed suffix as val11
# list of distinct first-letters available in ideas (may or may not contain all alphabets,depends upon elements in ideas)12
arr = list(names.keys())16
for j in range(i + 1, n):17
# a,b => 2 distinct first letters19
# adding the number of distinct posssible suffixes and multiplying by 2 as the new word formed might be "newword1 newword2" or "newword2 newword1"20
res += len(names[a] - names[b]) * len(names[b] - names[a]) * 2