class Solution { public boolean wordPattern(String pattern, String str) { String [] words = str.split(" "); if(words.length != pattern.length()) return false; HashMap map = new HashMap<>(); for(int i=0; i