Every email consists of a local name and a domain name, separated by the @ sign.
For example, in alice@leetcode.com, alice is the local name, and leetcode.com is the domain name.
Besides lowercase letters, these emails may contain '.'s or '+'s.
If you add periods ('.') between some characters in the local name part of an email address, mail sent there will be forwarded to the same address without dots in the local name.  For example, "alice.z@leetcode.com" and "alicez@leetcode.com" forward to the same email address.  (Note that this rule does not apply for domain names.)
If you add a plus ('+') in the local name, everything after the first plus sign will be ignored. This allows certain emails to be filtered, for example m.y+name@email.com will be forwarded to my@email.com.  (Again, this rule does not apply for domain names.)
It is possible to use both of these rules at the same time.
Given a list of emails, we send one email to each address in the list.  How many different addresses actually receive mails? 
 

Example 1:
Input: ["test.email+alex@leetcode.com","test.e.mail+bob.cathy@leetcode.com","testemail+david@lee.tcode.com"]
Output: 2
Explanation: "testemail@leetcode.com" and "testemail@lee.tcode.com" actually receive mails

 
Note:

1 <= emails[i].length <= 100
1 <= emails.length <= 100
Each emails[i] contains exactly one '@' character.
All local and domain names are non-empty.
Local names do not start with a '+' character.

Difficulty: EASY
Starter code: class Solution:
    def numUniqueEmails(self, emails: List[str]) -> int:
        

Solutions:
class Solution:

	def numUniqueEmails(self, emails: List[str]) -> int:
		s = []
		for email in emails:
			for i in range(len(email)):
				if email[i] == '@':
					localname = email[:i]
					domainname = email[i:]
					local = ''
					for x in localname:
						if x == '+':
							break
						local += x
					local = local.replace('.', '')
					s.append(local + domainname)
					break
		return len(set(s))


class Solution:

	def numUniqueEmails(self, emails: List[str]) -> int:
		result = set()
		for email in emails:
			state = 0
			real = []
			for c in email:
				if state == 0:
					if c == '.':
						continue
					elif c == '+':
						state = 1
					elif c == '@':
						real.append('@')
						state = 2
					else:
						real.append(c)
				elif state == 1:
					if c == '@':
						real.append('@')
						state = 2
				elif state == 2:
					real.append(c)
			result.add(''.join(real))
		return len(result)


class Solution:

	def numUniqueEmails(self, emails: List[str]) -> int:
		emailSet = set()
		for email in emails:
			newemail = []
			afterplus = False
			afterat = False
			for ch in email:
				if afterat:
					newemail.append(ch)
				elif ch == '.':
					pass
				elif ch == '+':
					afterplus = True
				elif ch == '@':
					newemail.append(ch)
					afterat = True
				elif not afterplus:
					newemail.append(ch)
			emailSet.add(''.join(newemail))
		return len(emailSet)


class Solution:

	def numUniqueEmails(self, emails: List[str]) -> int:
		dic = {}
		for email in emails:
			new_email = ''
			flag = 0
			for i in range(len(email)):
				if email[i] == '.':
					continue
				if email[i] == '+':
					flag = 1
				elif email[i] == '@':
					new_email += email[i:]
					break
				elif flag == 0:
					new_email += email[i]
			dic[new_email] = 1
		return len(dic)


class Solution:

	def numUniqueEmails(self, emails: List[str]) -> int:
		emailDict = {}
		total = 0
		for email in emails:
			domain = email.split('@')[1]
			localPart = email.split('@')[0]
			localPart = localPart.split('+')[0]
			localPart = localPart.replace('.', '')
			if domain not in emailDict:
				emailDict[domain] = set({localPart})
				total += 1
			elif localPart not in emailDict[domain]:
				emailDict[domain].add(localPart)
				total += 1
		return total


class Solution(object):

	def numUniqueEmails(self, emails):
		seen = set()
		for email in emails:
			(local, domain) = email.split('@')
			if '+' in local:
				local = local[:local.index('+')]
			seen.add(local.replace('.', '') + '@' + domain)
		return len(seen)


class Solution:

	def numUniqueEmails(self, emails: List[str]) -> int:
		out = set()
		for email in emails:
			ar = email.split('@')
			out.add(ar[0].split('+')[0].replace('.', '') + '@' + ar[1])
		return len(out)


class Solution:

	def numUniqueEmails(self, emails: List[str]) -> int:
		tmp = set()
		for email in emails:
			(local_name, domain_name) = email.split('@')
			before_first_plus = local_name.split('+')[0]
			without_dot_list = before_first_plus.split('.')
			final_local_name = ''.join(without_dot_list)
			tmp.add(final_local_name + '@' + domain_name)
		return len(tmp)


class Solution:

	def numUniqueEmails(self, emails: List[str]) -> int:
		final = set()
		for email in emails:
			(first, second) = email.split('@')
			if '+' in first:
				first = first.split('+')
				f = [i for i in first[0] if i != '.']
			else:
				f = [i for i in first if i != '.']
			final.add(''.join(f) + '@' + second)
		return len(final)


class Solution:

	def numUniqueEmails(self, emails: List[str]) -> int:
		l = []
		for i in emails:
			end = i[i.index('@'):]
			s = ''
			string = ''
			for j in i:
				if j == '.':
					continue
				if j == '+':
					break
				if j == '@':
					break
				else:
					s = s + j
			l.append(s + end)
		return len(set(l))