package leetcode;

/**
 * https://leetcode.com/problems/uncommon-words-from-two-sentences/
 */
public class Problem888 {
    public String[] uncommonFromSentences(String A, String B) {
        // TODO
        return null;
    }

    public static void main(String[] args) {
        Problem888 prob = new Problem888();
        System.out.println(prob.uncommonFromSentences("this apple is sweet", "this apple is sour")); // ["sweet","sour"]
        System.out.println(prob.uncommonFromSentences("apple apple", "banana")); // ["banana"]
    }
}

@@ -12,16 +12,116 @@
 tcode;%0A%0A
+import java.util.ArrayList;%0Aimport java.util.HashMap;%0Aimport java.util.List;%0Aimport java.util.Map;%0A%0A
 /**%0A * h
@@ -290,348 +290,727 @@
     
-// TODO%0A        return null;
+Map%3CString, Integer%3E map = new HashMap%3C%3E();%0A        for (String str : A.split(%22 %22)) %7B
 %0A    
-%7D%0A%0A
     
-public static void main(String%5B%5D args) %7B%0A        Problem888 prob = new Problem888();%0A        System.out.println(prob.uncommonFromSentences(%22this apple is sweet%22, %22this apple is sour%22)); // %5B%22sweet%22,%22sour%22%5D%0A        System.out.println(prob.uncommonFromSentences(%22apple apple%22, %22banana%22)); // %5B%22banana%22%5D
+    if (!map.containsKey(str)) %7B%0A                map.put(str, 1);%0A            %7D else %7B%0A                map.put(str, map.get(str) + 1);%0A            %7D%0A        %7D%0A        for (String str : B.split(%22 %22)) %7B%0A            if (!map.containsKey(str)) %7B%0A                map.put(str, 1);%0A            %7D else %7B%0A                map.put(str, map.get(str) + 1);%0A            %7D%0A        %7D%0A        List%3CString%3E result = new ArrayList%3C%3E();%0A        for (Map.Entry%3CString, Integer%3E e : map.entrySet()) %7B%0A            if (e.getValue() == 1) %7B%0A                result.add(e.getKey());%0A            %7D%0A        %7D%0A        return result.toArray(new String%5B0%5D);
 %0A   

Solve problem 888