Company: Goldman Sachs_10july
Difficulty: medium
File Grouping and Sorting Problem Description You are given a string S which contains a set of filenames separated by single spaces, where each filename consists of a file name and an extension, separated by a dot ( . ). Your task is to write a program that groups the files by their extension, and then sorts the files within each group as per ASCII norms. The groups should be sorted by their extension, and each group of files should be printed in a new line. Read the input from STDIN and print the output to STDOUT. Do not write arbitrary strings anywhere in the program, as these contribute to the standard output, and test cases will fail. Input Format A single line of input will contain a string S that contains space-separated file names in the format "filename.extension". Output Format The output consists of N lines, where each line represents a group of filenames that share the same extension, where: Each group (line) contains filenames with the same extension, sorted as per ASCII an