#K55992. Group Strings by Length

    ID: 30098 Type: Default 1000ms 256MiB

Group Strings by Length

Group Strings by Length

You are given a list of strings. Your task is to group these strings according to their lengths. For each distinct length, output a line with the length, a colon, and then all the strings of that length in the order they appeared in the input.

The groups must be printed in increasing order of string lengths.

Note: If there are no strings (i.e. n = 0), the program should produce no output.

Example:

Input:
7
apple
bee
car
dog
elephant
fig
go

Output: 2: go 3: bee car dog fig 5: apple 8: elephant

</p>

inputFormat

The first line contains a single integer n, which is the number of strings.

The following n lines each contain a non-empty string.

outputFormat

For each distinct string length found in the input, output a line in the format:

length: s1 s2 ... sk

where length is the integer representing the string length and s1, s2, ... sk are the strings of that length in the order they appear in the input. The lines must be printed in increasing order of length.

## sample
7
apple
bee
car
dog
elephant
fig
go
2: go

3: bee car dog fig 5: apple 8: elephant

</p>