#C14836. Process and Sort Names

    ID: 44529 Type: Default 1000ms 256MiB

Process and Sort Names

Process and Sort Names

You are given a list of names, one per line, from the standard input. Your task is to filter out any lines that are blank or contain only whitespace, sort the remaining names in alphabetical order, and then print each name on a new line.

Be sure to correctly handle any leading or trailing whitespace in the input lines.

In mathematical terms, if ( S ) is the set of non-empty trimmed strings extracted from input, you should output the sorted sequence of ( S ) in lexicographical order.

inputFormat

The input is provided via stdin and consists of multiple lines. Each line represents a name. Lines that are empty or consist solely of whitespace should be ignored.

outputFormat

Output the valid names sorted in alphabetical order, each on a separate line, via stdout.## sample

Emma
Oliver
 Ava

Sophia

 James
Ava

Emma James Oliver Sophia

</p>