class Solution(object):
    def uniqueMorseRepresentations(self, words):
        """
        :type words: List[str]
        :rtype: int
        """
        morse=[".-","-...","-.-.","-..",".","..-.","--.","....","..",".---","-.-",".-..","--","-.","---",".--.","--.-",".-.","...","-","..-","...-",".--","-..-","-.--","--.."]
        ans=[]
        for i in range(len(words)):
            temp = ""
            for j in range(len(words[i])):
                temp+=morse[ord(words[i][j])-ord('a')]
            if temp not in ans:
                ans.append(temp)
        return len(ans)
s = Solution()
words= ["gin", "zen", "gig", "msg"]
print(s.uniqueMorseRepresentations(words))