//解题思路:HashSet中的元素不可重复
public int uniqueMorseRepresentations(String[] words) {
        String[] morseCode= {".-","-...","-.-.","-..",".","..-.","--.","....","..",".---","-.-",".-..","--","-.","---",".--.","--.-",".-.","...","-","..-","...-",".--","-..-","-.--","--.."};
        HashSet<String> set=new HashSet<>();
        for(String word: words) {
            String code="";
            for(char c: word.toCharArray())
                code +=morseCode[c - 'a'];
            set.add(code);
        }
        
        return set.size();
    }