تمرین برنامه نویسی ٤١
Write a program to sort a list of numbers by specified direction.
Do not use the built-in sort
functions or methods.
First line of input is the list of numbers followed by the direction of sort. ASC: Ascending DESC: Descending
توضیحات
برنامه ای بنویسید که یک لیست از اعداد دریافت کرده و لیست را به صورت صعودی یا نزولی مرتب کند. از تابع sort استفاده نکنید. ورودی ASC به معنای صعودی و DESC به معنای نزولی است.
نمونه ورودی و خروجی
Input:
23 45 1 89 100 2 31 345 67 70 20
ASC
Output:
1 2 20 23 31 45 67 70 89 100 345