from collections import defaultdict
def solution(words):
answer = 0
cnt_defaultdict = defaultdict(int)
# 1,000,000
for word in words:
for i in range(1,len(word)+1):
cnt_defaultdict[word[:i]] += 1
for word in words:
for i in range(1,len(word)+1):
if cnt_defaultdict[word[:i]] == 1:
break
answer += i
return answer