Unique Email Addresses

Every email has a local name and a domain name separated by "@". In the local name, dots are ignored and everything after the first "+" is ignored; neither rule applies to the domain. Given an array of emails where each receives a message, return how many different addresses actually receive mail.

30:00

Unique Email Addresses
easy
Free written solution
Topics
Companies

Every email has a local name and a domain name separated by "@". In the local name, dots are ignored and everything after the first "+" is ignored; neither rule applies to the domain. Given an array of emails where each receives a message, return how many different addresses actually receive mail.

Example 1:
Output: 2
Constraints:
  • 1≤emails.length≤1001 \leq \text{emails.length} \leq 100

  • 1≤emails[i].length≤1001 \leq \text{emails}[i].\text{length} \leq 100

  • emails[i] consists of lowercase English letters, +, . and @.

  • Each emails[i] contains exactly one @ character.

  • All local and domain names are non-empty; local names do not start with +.

  • Domain names end with the ".com" suffix and have at least one character before it.

Test Cases
Input (Stdin)
Expected Output (Stdout)
Execution Result

Run code to see results.

Input

Start with an empty set. Each email is rewritten to the address that really receives the mail, and the set keeps one copy of each.

normalizer

waiting for the first email

Variables
VariableValue
len(seen)0
DepthFunction Call
Stack empty
0/14