Shortest Words First
Sort the words by length; equal-length words go alphabetically.
Input: one line with words separated by single spaces.
Output: the sorted words on one line.
Constraints:
- 1 to 200 lowercase words
Sample Tests
Input 1
banana kiwi apple fig
Output 1
fig kiwi apple banana
Input 2
bb aa
Output 2
aa bb
Discussion (opens after you solve — no spoilers before)
No comments yet.