#C13688. Group Strings by Length

    ID: 43253 Type: Default 1000ms 256MiB

Group Strings by Length

Group Strings by Length

You are given a list of strings. Your task is to group the strings by their length. For each distinct string length, you should print a line that starts with the length, followed by a colon, and then all the strings of that length in the order they appear in the input. The groups must be output in increasing order of string length.

Formally, let \( n \) be the number of strings and let \( s_1, s_2, \ldots, s_n \) be the list of strings. For each unique length \( L \), output a line in the following format:

[ L: s_{i_1} \ s_{i_2} \ \ldots \ s_{i_k} ]

where each \( s_{i_j} \) is a string with length \( L \), and the order of strings is the same as their input order.

inputFormat

The first line of the input contains a single integer \( n \) (\( 0 \le n \le 1000 \)), which denotes the number of strings. The following \( n \) lines each contain one non-empty string. Each string consists of printable characters without spaces.

outputFormat

For each distinct string length present in the input, output a single line. Each line should start with the length, followed by a colon and a space, and then the list of strings (separated by a single space) that have that length. The groups must appear in increasing order of length.

## sample
9
a
abc
de
f
ghij
klm
no
p
qrst
1: a f p

2: de no 3: abc klm 4: ghij qrst

</p>