#K82697. Filter Emails by Domain

    ID: 36033 Type: Default 1000ms 256MiB

Filter Emails by Domain

Filter Emails by Domain

You are given a list of email addresses and a domain. Your task is to filter out all email addresses that do not belong exactly to the given domain. An email address is considered to belong to the domain if the part after the '@' symbol is equal to the given domain. After filtering, you must output the remaining email addresses in alphabetical (lexicographical) order.

Note: The domain comparison is case sensitive.

inputFormat

The input is read from standard input (stdin) and consists of multiple lines. The first line contains a string representing the domain to filter by. The second line contains an integer N, the number of email addresses. The following N lines each contain an email address.

outputFormat

Output the filtered email addresses in alphabetical order, each on a new line. If no email address matches the given domain, produce no output.## sample

gmail.com
5
alice@gmail.com
bob@yahoo.com
carol@gmail.com
dave@hotmail.com
eve@gmail.com
alice@gmail.com

carol@gmail.com eve@gmail.com

</p>