C++ Solution || Beats 100% || Runtime 0ms
Complexity\n- Time complexity: O(n1+n2)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity: O(m)\n  m:number of unique words in string1 and strin
# Complexity\n- Time complexity: O(n1+n2)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(m)\n  m:number of unique words in string1 and string2\n# Code\n```\nclass Solution {\npublic:\n    vector<string> uncommonFromSentences(string s1, string s2) {\n\n    unordered_map<string, int> m;\n    string word;\n    for (int i = 0; i < s1.size(); i++)\n    {\n        if (s1[i] != \' \')\n            word.push_back(s1[i]);\n        if (s1[i] == \' \' || i == s1.size() - 1)\n        {\n            m[word]++;\n            word = "";\n        }\n    }\n    for (int i = 0; i < s2.size(); i++)\n    {\n        if (s2[i] != \' \')\n            word.push_back(s2[i]);\n        if (s2[i] == \' \' || i == s2.size() - 1)\n        {\n            m[word]++;\n            word = "";\n        }\n    }\n    vector<string> ans;\n    for (auto e : m)\n        if (e.second == 1)\n            ans.push_back(e.first);\n    return ans;\n    \n    }\n};\n```
['C++']