A seldom-known fact about email addresses is that you can format a given address in several different ways. In particular:
- The entire address is case-insensitive.
- Dots (
.
) before the at-sign (@
) sign are ignored. - A plus (
+
) followed by any string can be added before the at-sign (@
). The plus and following string are ignored.
For example, foo@bar.com
and fO.o+baz123@bAR.com
refer to the same email address.
John runs a service where users sign up with their email address. He has noticed that some users have signed up multiple times using different representations of the same address. He has asked for your help to determine the number of unique email addresses that have signed up on his site.
Input Specification
The input will contain 10 datasets. Each dataset begins with a line containing an integer
For the first 6 cases,
Output Specification
For each dataset, output the number of unique email addresses in the dataset.
Sample Input (Two Datasets Shown)
3
foo@bar.com
fO.o+baz123@bAR.com
foo@bar..com
3
c++@foo.com
c...@Foo.com
.c+c@FOO.COM
Sample Output
2
1
Educational Computing Organization of Ontario - statements, test data and other materials can be found at ecoocs.org
Comments
can somebody please tell me why my code isn't working
Each input case contains 10 data sets, so your code has to run 10 times, not once.
Why is the time limit 30s??
Becouse you need to use sets not lists. Searching lists is very slow. Seraching sets is much faster (in my case more than 2000 times faster).
Because the ECOO judges are the teacher's, and they'll wait a maximum of 30 seconds for your code to produce output.