s
into words based on spaces.pattern
, return False
.char_to_word
and word_to_char
.pattern
and the corresponding words in s
.
a. If the character is not in char_to_word
, check if the word is in word_to_char
. If it is, return False
.
b. If the character is in char_to_word
, check if it maps to a different word. If it does, return False
.
c. Update char_to_word
and word_to_char
with the new character-word pair.True
.