链接:https://leetcode-cn.com/problems/unique-morse-code-words/
class Solution {
public int uniqueMorseRepresentations(String[] words) {
String[] codes={".-","-...","-.-.","-..",".","..-.","--.","....","..",".---","-.-",".-..","--","-.","---",".--.","--.-",".-.","...","-","..-","...-",".--","-..-","-.--","--.."};
HashSet<String> set=new HashSet<String>();
for (String word : words) {
StringBuilder sb=new StringBuilder("");
for(int i=0;i<word.length();i++){
sb.append(codes[word.charAt(i)-97]);
}
set.add(sb.toString());
}
return set.size();
}
}