Untitled
unknown
plain_text
18 days ago
673 B
6
Indexable
Never
class Solution { public: vector < string> findUncommonWords(string s1, string s2) { s1+=' '; s1+=s2; unordered_map < string , int > mp; vector < string > ans; stringstream s1s(s1); stringstream sCopy1s(s1); string token; char delimiter = ' '; while (getline(s1s, token, delimiter)) { mp[token]++; } while (getline(sCopy1s, token, delimiter)) { if(mp[token] == 1)ans.push_back(token); } return ans; } vector<string> uncommonFromSentences(string s1, string s2) { return findUncommonWords(s1, s2); } };
Leave a Comment