class Solution:
    def findAndReplacePattern(self, words, pattern):
        """
        :type words: List[str]
        :type pattern: str
        :rtype: List[str]
        """
        matches = []
        size = len(set(pattern))
        for w in words:
            s = set(zip(w, pattern))
            if len(set(w)) == size and size == len(s):
                matches.append(w)
        return matches
                        
        