ECOO '19 R2 P1 - Email

View as PDF

Submit solution

Points: 5 (partial)
Time limit: 30.0s
Memory limit: 512M

Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

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, [email protected] and [email protected] 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 N (1 \le N \le 100\,000), the number of email addresses. The next N lines each contain an email address S (1 \le |S| \le 30). The email address will be formatted as a non-empty user part consisting of letters, numbers, dots, and pluses followed by a single at-sign followed by a non-empty domain part consisting of letters, numbers, and dots.

For the first 6 cases, N \le 100.

Output Specification

For each dataset, output the number of unique email addresses in the dataset

Sample Input (Two Datasets Shown)

[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]

Sample Output


Educational Computing Organization of Ontario - statements, test data and other materials can be found at


  • 1
    henrybaolol9  commented on July 21, 2020, 12:13 p.m.

    can somebody please tell me why my code isn't working

    • 2
      AlanL  commented on July 21, 2020, 2:01 p.m.

      Each input case contains 10 data sets, so your code has to run 10 times, not once.

  • 14
    idkanything  commented on April 30, 2019, 11:37 a.m.

    Why is the time limit 30s??

    • 27
      Rimuru  commented on April 30, 2019, 11:56 a.m.

      Because the ECOO judges are the teacher's, and they'll wait a maximum of 30 seconds for your code to produce output.