Leetcode 965 Solution

This article provides solution to leetcode question 965 (unique-email-addresses)

https://leetcode.com/problems/unique-email-addresses

Solution

class Solution:
    def numUniqueEmails(self, emails: 'List[str]') -> 'int':
        res = set()
        for email in emails:
            name, domain = email.split('@')
            name = name.split('+')[0]
            name = name.replace(".", "")
            res.add("{}@{}".format(name, domain))

        return len(res);