p=abba s=[happy dog dog happy]
var wp=function(p,s){
const w2c=new Map()
const c2w=new Map()
const w=s.split(' ')
if(p.length!=w.length){
return false
}
for(const [i,v] of w.entries()){
const ch=p[i]
if(w2c.has(v)&&w2c.get(w)!=ch||c2w.hash(ch)&&c2w.get(ch)!=v){
return false
}
w2c.set(v,ch)
c2w.set(ch,v)
}
return true
}