class Solution {
public:
vector<string> uncommonFromSentences(string A, string B) {
stringstream ss1(A);
stringstream ss2(B);
vector<string>ans,v1,v2;
map<string,int>mp1,mp2;
string s;
while(ss1>>s)
{
if(!mp1.count(s)) mp1[s] = 1;
else mp1[s]++;
v1.push_back(s);
}
while(ss2>>s)
{
if(!mp2.count(s)) mp2[s] = 1;
else mp2[s]++;
v2.push_back(s);
}
for(int i = 0;i<v1.size();i++)
{
if(mp1[v1[i]] == 1 && !mp2.count(v1[i])) ans.push_back(v1[i]);
}
for(int i = 0;i<v2.size();i++)
{
if(mp2[v2[i]] == 1 && !mp1.count(v2[i])) ans.push_back(v2[i]);
}
return ans;
}
};