Email Normalizer
Python
Medium
2 views
Problem Description
Read n email strings. Create Email class that normalizes (lowercase, trim spaces). Output count of unique normalized emails.
Input Format
First line n. Next n lines emails.
Output Format
One integer count.
Sample Test Case
Input:
5
Ravi@Gmail.com
ravi@gmail.com
A@B.COM
x@y.com
X@Y.COM
Official Solution
import sys
lines=sys.stdin.read().splitlines()
if not lines: sys.exit(0)
n=int(lines[0].strip())
class Email:
def __init__(self,s):
self.s=s
def norm(self):
return self.s.strip().lower()
seen=set()
for i in range(1,1+n):
e=Email(lines[i] if i<len(lines) else '')
seen.add(e.norm())
print(len(seen))
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!