#C13793. Extract Unique Email Domains
Extract Unique Email Domains
Extract Unique Email Domains
You are given a single string that contains one or more email addresses separated by semicolons (;
). Your task is to extract all unique domain names (i.e., the part after the '@' symbol) from these email addresses and print them in lexicographical order (sorted in ascending order).
For example, if the input is alice@example.com;bob@test.com;carol@example.com
then the output should be:
example.com test.com
Make sure to read input from standard input (stdin) and print your output to standard output (stdout). Each domain should be printed on a separate line.
inputFormat
The input consists of a single line containing email addresses separated by semicolons (;
).
Example: alice@example.com;bob@test.com;carol@example.com
outputFormat
Output all unique domain names in lexicographical order, each on a new line.
## samplealice@example.com
example.com
</p>