Given a list of strings words and a string pattern, return a list of all strings in words that match pattern. You may return the answer in any order.
A word matches the pattern if there exists a bijection between the letters in pattern and the letters in the word such that replacing every character in pattern with its mapped character produces the word. That is, every letter in pattern maps to a unique letter, and no two distinct letters in pattern map to the same letter.
Constraints:
pattern.length
words.length
words[i].length pattern.length
pattern and words[i] consist only of lowercase English letters.
Given a list of strings words and a string pattern, return a list of all strings in words that match pattern. You may return the answer in any order.
A word matches the pattern if there exists a bijection between the letters in pattern and the letters in the word such that replacing every character in pattern with its mapped character produces the word. That is, every letter in pattern maps to a unique letter, and no two distinct letters in pattern map to the same letter.
Constraints:
pattern.length
words.length
words[i].length pattern.length
pattern and words[i] consist only of lowercase English letters.