Word pattern - leetcode problem

ques->https://leetcode.com/problems/word-pattern/

i need help in this ques. I am not able to solve to this . i did try using map but it was wrong approach.

so the main point is to use 2maps
since a bijection is required so u need to check for consistency from both sides
like u first check
pattern =

"abba"

, str =

"dog cat cat fish"

a-> dog
b->cat
then b->cat
then check if a is mapped to fish
return false at this point since a is mapped previously to dog

also taking about the next test case
pattern =

"abba"

, str =

"dog dog dog dog"

Output: false
a->dog
b->dog b->dog a->dog
but then when u check the mapping from str to pattern
u
map
dog->a
then when checking for 2nd position
dog->b this shoudl return false

also some corner cases
when the size of pattern is more than no of string in str
or pattern is 0 sized

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

I know you doubt this ques. Maybe the leetcode patterns training website can help you.