1class Solution:2def shortestCompletingWord(self, licensePlate: str, words: List[str]) -> str:3newPlate = "" # modify the licensePlate4for i in licensePlate:5if i.isalpha():6newPlate += i.lower()78c = Counter(newPlate)9l1 = [] # store (word,len,index)10for idx, word in enumerate(words):11if Counter(word) >= c:12l1.append((word, len(word), idx))13l1.sort(key=lambda x: (x[1], idx))14return l1[0][0]