1 class Solution
2 {
3 public:
4 vector<string> uncommonFromSentences(string A, string B)
5 {
6 map<string,int> A_store,B_store;
7 string A_words,B_words;
8 for(int i = 0;i < A.size();i ++)
9 {
10 if(A[i]!=' ')
11 {
12 A_words += A[i];
13 }
14 else
15 {
16 A_store[A_words] ++;
17 A_words.clear();
18 }
19 }
20 A_store[A_words] ++;
21 A_words.clear();
22 for(int i = 0;i < B.size();i ++)
23 {
24 if(B[i]!=' ')
25 {
26 B_words += B[i];
27 }
28 else
29 {
30 B_store[B_words] ++;
31 B_words.clear();
32 }
33 }
34 B_store[B_words] ++;
35 B_words.clear();
36 vector<string> result;
37 for(auto i = A_store.begin();i != A_store.end();i ++)
38 {
39 string tmp = i->first;
40 int flag = 0;
41 for(auto j = B_store.begin();j != B_store.end();j ++)
42 {
43 if(j->first == tmp)
44 flag = 1;
45 }
46 if(flag==1)
47 continue;
48 else
49 {
50 if(i->second==1)
51 result.push_back(tmp);
52 }
53 }
54 for(auto i = B_store.begin();i != B_store.end();i ++)
55 {
56 string tmp = i->first;
57 int flag = 0;
58 for(auto j = A_store.begin();j != A_store.end();j ++)
59 {
60 if(j->first == tmp)
61 flag = 1;
62 }
63 if(flag==1)
64 continue;
65 else
66 {
67 if(i->second==1)
68 result.push_back(tmp);
69 }
70 }
71 return result;
72 }
73 };