1 class Solution 2 { 3 public: 4 char findTheDifference(string s, string t) 5 { 6 unordered_map<char,int> hash; 7 for(auto a : s) hash[a] ++; 8 for(auto a : t) 9 { 10 if(hash.find(a) == hash.end()) return a; 11 else 12 { 13 hash[a] --; 14 if(hash[a] == 0) hash.erase(a); 15 } 16 } 17 return ' '; 18 } 19 };