Advertisement
sawczakl

DMOJ Email

Jun 4th, 2025
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.68 KB | Source Code | 0 0
  1. # 10 datasets
  2. for _ in range(10):
  3.    
  4.     # a set automaticlaly manages duplicates
  5.     unique_emails = set()
  6.    
  7.     # each one has N email addresses
  8.     n = int(input(''))
  9.     for __ in range(n):
  10.        
  11.         # email address has a user part, @, domain part
  12.         s = input('').lower()
  13.         user, domain = s.split('@')
  14.        
  15.         # normalize the user part
  16.         user = user.replace('.', '')
  17.         user = user.split('+')[0]
  18.         email = f'{user}@{domain}'
  19.        
  20.         # using a set, adding will not create duplicates
  21.         # this removes the 'check' process in a long list!!!
  22.         unique_emails.add(email)
  23.    
  24.     print(len(unique_emails))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement