Sponsored
Use these hints if you're stuck. Try solving on your own first.
Store each word and their relative position. Then, sort them by length of words in case of tie by their original order.
Solve with full IDE support and test cases