3
unordered_set<string> processed_words;4
string m[26]; // char to string mapping6
bool crunch_next_word(char c, string word) {8
if (m[idx].empty() && processed_words.count(word) == 0) {10
processed_words.insert(word);12
} else if (m[idx] == word)18
bool wordPattern(string pattern, string s) {22
int end = s.find(' ');24
string word = s.substr(start, end - start);25
char c = pattern[count];26
if (!crunch_next_word(c, word)) return false;29
end = s.find(' ', start);31
if (count == pattern.length()) return false;33
if (count != pattern.length() - 1) return false;34
string word = s.substr(start, end - start);35
char c = pattern[count];36
if (!crunch_next_word(c, word)) return false;