Simple and Easy CPP code!💯✅☮️
\n# Code\ncpp []\nclass Solution {\npublic:\n    vector<string> uncommonFromSentences(string s1, string s2) {\n        unordered_map<string,int>mp;\n        str
\n# Code\n```cpp []\nclass Solution {\npublic:\n    vector<string> uncommonFromSentences(string s1, string s2) {\n        unordered_map<string,int>mp;\n        string str="";\n        vector<string>s;\n        for(int i=0;i<=s1.size();i++)\n        {\n            if(i==s1.size() or s1[i]==\' \')\n            {\n                if(!str.empty()){\n                mp[str]++;\n                str="";\n                }\n            }\n            else{\n                str+=s1[i];\n            }\n        }\n        for(int i=0;i<=s2.size();i++)\n        {\n            if(i==s2.size() or s2[i]==\' \')\n            {\n                if(!str.empty()){\n                mp[str]++;\n                str="";\n                }\n            }\n            else{\n                str+=s2[i];\n            }\n        }\n        for(auto it=mp.begin();it!=mp.end();it++)\n        {\n            if(it->second ==1)\n            {\n                s.push_back(it->first);\n            }\n        }\n\n        return s;\n    }\n};\n```\n### Intuition:\nThe problem asks for finding uncommon words in two sentences. A word is uncommon if it appears exactly once across both sentences. We can solve this by iterating through each sentence, counting occurrences of each word, and finally returning the words that appear exactly once.\n\n### Approach:\n1. **Data Structures**: \n   - We use an `unordered_map<string, int>` to store word counts. The key is each word, and the value is the count of how many times that word appears across both sentences.\n   - A `vector<string>` is used to store the result of uncommon words.\n\n2. **Processing Each Sentence**:\n   - For both `s1` and `s2`, we loop through each character to build words. A word is delimited by spaces, so every time we encounter a space or reach the end of the string, we consider the accumulated characters as a word and update its count in the map.\n   - After processing both sentences, the map will contain the count of each word from both sentences.\n\n3. **Collect Uncommon Words**:\n   - We then iterate over the map and collect words that have a count of exactly 1. These are the uncommon words that appeared only once across both sentences.\n\n4. **Edge Case**:\n   - If one or both sentences are empty, the algorithm will return an empty list since there are no words to process.\n\n### Complexity:\n- **Time Complexity**:\n   - Let `n` be the total number of characters in `s1` and `m` be the total number of characters in `s2`.\n   - Processing each sentence involves iterating through all characters to build words, which takes O(n) for `s1` and O(m) for `s2`.\n   - Inserting words into the unordered map and retrieving them both have an average complexity of O(1), so iterating through the map to collect the uncommon words takes O(n + m).\n   - Thus, the overall time complexity is **O(n + m)**.\n\n- **Space Complexity**:\n   - We use additional space for the unordered map and vector. The map can store up to O(n + m) words, where `n` and `m` are the lengths of `s1` and `s2`, respectively. The space used by the result vector depends on the number of uncommon words.\n   - Thus, the space complexity is **O(n + m)**.
['C++']