C++ 100% with unordered_map
Combine two strings separated with a string, istringstream and getline split up the string so that we can count the occurrences in an unordered_map, then simply
Combine two strings separated with a string, istringstream and getline split up the string so that we can count the occurrences in an unordered_map, then simply list the entries with an occurrence of 1 in a vector.\n\n```cpp\nclass Solution {\npublic:\n    vector<string> uncommonFromSentences(string A, string B) {\n        // combine the two strings for simplicity and construct an istringstream\n        istringstream combined(A + " " + B);\n        \n        // our word will be put in this variable by getline\n        string word;\n        \n        // keep track of word occurrences\n        unordered_map<string, int> counts;\n        \n        // get the next word and increase its count in our map\n        while (getline(combined, word, \' \'))\n            counts[word] += 1;\n        \n        // put the words with an occurrence of 1 in our result vector\n        vector<string> result;\n        for(auto &p : counts) {\n            if(p.second == 1)\n                result.push_back(p.first);\n        }\n        \n        return result;\n    }\n};\n```
[]