#K6131. Rearrange Words by Length

    ID: 31281 Type: Default 1000ms 256MiB

Rearrange Words by Length

Rearrange Words by Length

You are given a sentence that contains several words separated by spaces. Your task is to rearrange the words in ascending order based on their lengths. If two words have the same length, their relative order (as they appear in the input) must be preserved.

Let \( l(w) \) denote the length of the word \( w \). You need to output the words sorted by \( l(w) \) in ascending order.

Example:

Input: The quick brown fox jumps over the lazy dog
Output: The fox the dog over lazy quick brown jumps

inputFormat

The input consists of a single line containing a sentence. The sentence is composed of words separated by spaces.

outputFormat

Output a single line which is the modified sentence with the words rearranged in ascending order of their lengths. If two words share the same length, maintain their original order.

## sample
The quick brown fox jumps over the lazy dog
The fox the dog over lazy quick brown jumps