class Solution {
public int uniqueMorseRepresentations(String[] words) {
String[] morse = {".-","-...","-.-.","-..",".","..-.","--.","....","..",".---","-.-",".-..","--","-.","---",".--.","--.-",".-.","...","-","..-","...-",".--","-..-","-.--","--.."};
List result = new ArrayList();
int count = 0;
for(String word : words) {
StringBuffer sb = new StringBuffer();
char[] chs = word.toCharArray();
for(char ch : chs) {
int offset = ch - 'a';
sb.append(morse[offset]);
}
if(!result.contains(sb.toString())) {
result.add(sb.toString());
count ++;
}
}
return count;
}
}