#!/usr/bin/env python3
# encoding: utf-8

'''
Description: extract email addresses from stdin to stdout
Usage example: cat whatever.txt | extract-email | sort -fu > addr.txt
'''

import re
import sys

email_pattern = re.compile('([\w\-\.]+@(\w[\w\-]+\.)+[\w\-]+)')

for line in sys.stdin:
    # There may be several matches per line.
    for match in email_pattern.findall(line):
        print(match[0])
