Ctrl K

Real Inboxes Behind the Addresses

Easy
A mail service receives a list of addresses addresses. Each address is a local name and a domain separated by @. In the **local name** the service applies two rules: - dots . are ignored: a.n.na and anna are the same; - everything from the first + onward is dropped: anna+promo becomes anna. The domain is left untouched. One message was sent to every address. How many distinct inboxes actually receive mail?
Example 1
addresses=["[email protected]", "[email protected]", "[email protected]"] → 2

The first two go to [email protected], the third to [email protected]: different domains, so 2 inboxes.

Example 2
addresses=["[email protected]", "[email protected]"] → 2

Different local names mean different inboxes.

Constraints
  • 1 ≤ len(addresses) ≤ 100
  • 1 ≤ len(addresses[i]) ≤ 100
  • Addresses consist of lowercase English letters, +, . and exactly one @
  • Local name and domain are non-empty; the local name does not start with +
  • The domain ends with .com and has at least one character before it
Have you seen this problem in a real interview?
Solved by0
Tried by0
Submissions0
Acceptance—
Topics
Similar problemsOne-Row Typing EasyDinner for Two EasyPhrases with Synonyms EasyWord from a License Plate EasyDistinct Morse Signals Easy
loading Python…
Input
addresses=["[email protected]", "[email protected]", "[email protected]"]
Expected
2

Run checks the first 3 tests in your browser. Submit checks all 71 tests on the server, hidden ones included.