class Solution { public: string mostCommonWord(string paragraph, vector<string>& banned) { string word = ""; unordered_map<string, int> map_words; for(char c : paragraph) { if(isalpha(c)) { word += tolower(c); } else if(word != "") { map_words[word]++; word = ""; } } if(word != "") { map_words[word]++; } string ans = ""; int count = 0; for(auto s : banned) { map_words[s] = 0; } for(auto s : map_words) { cout << s.first << " " << s.second << "\n"; if(s.second > count) ans = s.first, count = s.second; } return ans; } };