Daily challenge for 2025-03-11
70. Unique Email Addresses
Write a function solve that returns the number of unique email addresses in an array after parsing '+' and '.' rules.
Every valid email consists of a local name and a domain name, separated by the '@' sign. Besides lowercase letters, the email may contain one or more '.' or '+'. If there are 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. If there is a plus '+' in the local name, everything after the first plus sign will be ignored. This allows certain emails to be filtered. Note that these rules do not apply to domain names.
Example:Input: ["test.email+alex@leetle.app","test.e.mail+bob.cathy@leetle.app"]Output: 1
Explanation: Ignore the '.' and everything after the '+' sign in the local name, making both emails equivalent to testemail@leetle.app, so there is only 1 unique email.