#K68317. Unique Email Addresses

    ID: 32838 Type: Default 1000ms 256MiB

Unique Email Addresses

Unique Email Addresses

In many email services, the local part of an email address can be modified without affecting delivery. In this problem, you are given a list of email addresses and you must compute the number of unique addresses after normalization.

The normalization process for each email is as follows:

  • Split the email into a local part and a domain part using the '@' symbol.
  • In the local part, ignore all characters after a plus ('+') sign (if any).
  • Remove all the dot ('.') characters from the local part.
  • Concatenate the processed local part with the domain part.

For example, the email test.email+alex@leetcode.com is normalized to testemail@leetcode.com.

inputFormat

The first line contains an integer (n) representing the number of email addresses. Each of the following (n) lines contains a single email address.

outputFormat

Output a single integer that denotes the number of unique email addresses after normalization.## sample

3
test.email+alex@leetcode.com
test.e.mail+bob.cathy@leetcode.com
testemail+david@lee.tcode.com
2