Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def quickSort(arr):
- if len(arr) <= 1:
- return arr
- pivot = arr[len(arr) // 2]
- left = [word for word in arr if len(word) < len(pivot)]
- middle = [word for word in arr if len(word) == len(pivot)]
- right = [word for word in arr if len(word) > len(pivot)]
- return quickSort(left) + middle + quickSort(right)
- sentence = input().split()
- sorted_sentence = quickSort(sentence)
- result = " ".join(sorted_sentence)
- print(result)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement