@@ -0,0 +1,941 @@
+package umcw;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.HashSet;%0Aimport java.util.Set;%0A%0A/**%0A * Answer%0A */%0Apublic class Answer %7B%0A%0A  public static void main(String%5B%5D args) %7B%0A%0A    String%5B%5D stary = %7B%22gin%22, %22zen%22, %22gig%22, %22msg%22%7D;%0A%0A    Solution sol = new Solution();%0A    int rt = sol.uniqueMorseRepresentations(stary);%0A%0A    System.out.println(rt);%0A  %7D%0A%7D%0A%0Aclass Solution %7B%0A%0A  private static String%5B%5D CODES = new String%5B%5D %7B %22.-%22, %22-...%22, %22-.-.%22, %22-..%22, %22.%22, %22..-.%22, %22--.%22, %22....%22, %22..%22, %22.---%22, %22-.-%22, %22.-..%22,%0A      %22--%22, %22-.%22, %22---%22, %22.--.%22, %22--.-%22, %22.-.%22, %22...%22, %22-%22, %22..-%22, %22...-%22, %22.--%22, %22-..-%22, %22-.--%22, %22--..%22 %7D;%0A  public int uniqueMorseRepresentations(String%5B%5D words) %7B%0A%0A    Set%3CString%3E set = new HashSet();%0A    for (String word : words) %7B%0A%0A      StringBuilder str = new StringBuilder();%0A      for (char c: word.toCharArray())%7B%0A         str.append(CODES%5Bc - 'a'%5D);%0A      %7D%0A      set.add(str.toString());%0A    %7D%0A%0A    return set.size();%0A  %7D%0A%7D%0A

add unique-morse-code-words algorithm solution