1408. String Matching in an Array
On This Page
class Solution:
def stringMatching(self, words: List[str]) -> List[str]:
res = []
for i, s in enumerate(words):
if any(i != j and s in t for j, t in enumerate(words)):
res.append(s)
return res