#K63402. Unique Email Addresses
Unique Email Addresses
Unique Email Addresses
Given a list of email addresses, your task is to determine the number of unique email addresses after processing them. For each email address, consider it to be composed of two parts separated by the '@' symbol: the local part and the domain. Transform the local part by removing all occurrences of the dot character ('.') and ignoring any characters after (and including) the first plus sign ('+'). The domain part remains unchanged. Formally, for an email address where , let be defined as [ L' = \text{removeDots}(\text{prefixBefore}(L, '+')) ] Then the processed email becomes . Return the number of unique processed email addresses.
Input is given via standard input and output via standard output.
inputFormat
The first line contains an integer denoting the number of email addresses. Each of the next lines contains one email address.
outputFormat
Output a single integer, the number of unique email addresses after processing.## sample
3
test.email+alex@leetcode.com
test.e.mail+bob.cathy@leetcode.com
testemail+david@lee.tcode.com
2