C++ | Using Unordered Map | Easy to Understand | Simplest Solution
Please Upvote if you found this useful.\n\n\nclass Solution {\npublic:\n    vector<string> uncommonFromSentences(string s1, string s2) \n    {\n        vector<s
**Please Upvote if you found this useful.**\n\n```\nclass Solution {\npublic:\n    vector<string> uncommonFromSentences(string s1, string s2) \n    {\n        vector<string> ans;\n        string str= "";\n        unordered_map<string, int> mp;\n        for(int i=0; i<s1.length(); i++)\n        {\n            if(s1[i]== \' \')\n            {\n                mp[str]++;\n                str.clear();\n            }\n            else\n            {\n                str+= s1[i];\n            }\n        }\n        mp[str]++;\n        str.clear();\n        for(int i=0; i<s2.length(); i++)\n        {\n            if(s2[i]== \' \')\n            {\n                mp[str]++;\n                str.clear();\n            }\n            else\n            {\n                str+= s2[i];\n            }\n        }\n        mp[str]++;\n        str.clear();\n        for(auto it : mp)\n        {\n            if(it.second== 1)\n            {\n                ans.push_back(it.first);\n            }\n        }\n        return ans;\n    }\n};\n```
['C', 'C++']