Problem Statment
Given a dictionary of words and a pattern. Every character in the pattern is uniquely mapped to a character in the dictionary. Find all such words in the dictionary that match the given pattern.
Input
The First line contains the number(N) of words in dictionary, following line contains N strings and last line contains the pattern.
Output
All strings (seperated by spaces) in dictionary that match the given pattern.
Example 1:Input:
4
abb abc xyz xyy
foo
Output:
abb xyy
Explanation: xyy and abb have the same character at index 1 and 2 like the pattern.