We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1b4fea4 commit 03b68bfCopy full SHA for 03b68bf
884. Uncommon Words from Two Sentences
@@ -0,0 +1,25 @@
1
+class Solution {
2
+public:
3
+ vector<string> uncommonFromSentences(string s1, string s2) {
4
+ string s = s1+ " "+ s2+ " ";
5
+ // cout<< s<< endl;
6
+ unordered_map<string, int>mpp;
7
+
8
+ string temp = "";
9
+ for(int i = 0; i < s.size(); i++){
10
+ if(s[i] == ' '){
11
+ cout<<temp<< endl;
12
+ mpp[temp]++;
13
+ temp = "";
14
+ }
15
+ else
16
+ temp+=s[i];
17
18
+ vector<string>ans;
19
+ for (auto it :mpp) {
20
+ if(it.second == 1)
21
+ ans.push_back(it.first);
22
23
+ return ans;
24
25
+};
0 commit comments