#K73082. Sort Strings by Length
Sort Strings by Length
Sort Strings by Length
You are given a list of strings. Your task is to sort these strings in ascending order based on their lengths.
Input Format: The first line contains an integer , representing the number of strings. The following lines each contain one string.
Output Format: Output the sorted list of strings, each on its own line.
Note: If two strings have the same length, maintain their original relative order. This stability can be ensured by using a stable sorting algorithm.
inputFormat
The input begins with an integer (), which indicates how many strings follow. Each of the next lines contains a non-empty string.
outputFormat
Print the strings sorted in ascending order by their length. Each string must be printed on a separate line.## sample
6
apple
banana
kiwi
fig
strawberry
date
fig
kiwi
date
apple
banana
strawberry
</p>