We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
import re
pattern= re.compile(r'\b[\w.]+@[a-zA-Z0-9.]+\w\b')
n=input()
email=[]
for i in range(eval(n)):
text=input()
add=pattern.findall(text)
if add:
email.extend(add)
set_email=list(set(email))
set_email.sort()
string=';'.join(set_email)
print(string)
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Detect the Email Addresses
You are viewing a single comment's thread. Return to all comments →
import re pattern= re.compile(r'\b[\w.]+@[a-zA-Z0-9.]+\w\b') n=input() email=[] for i in range(eval(n)): text=input() add=pattern.findall(text) if add: email.extend(add) set_email=list(set(email)) set_email.sort() string=';'.join(set_email) print(string)