# https://leetcode.com/problems/string-matching-in-an-array from typing import List class Solution: def stringMatching(self, words: List[str]) -> List[str]: result = [] for curr in range(len(words)): for another in range(len(words)): if curr != another and words[curr] in words[another]: result.append(words[curr]) break return result