import java.util.* ;
import java.io.*;
import java.util.ArrayList;
public class Solution {
public static boolean isPatternMatching(String pattern, ArrayList<String> words) { ArrayList<String> al=new ArrayList(Arrays.asList(pattern.split(""))); boolean res=true;
for(int i=0;i<al.size();i++){ if(al.lastIndexOf(al.get(i))!=words.lastIndexOf(words.get(i)))
res=false;
} return res;
}
}