#K70497. Bookshelf Organization
Bookshelf Organization
Bookshelf Organization
You are given a list of book widths. Your task is to organize the books by sorting them in non-decreasing order. In other words, if the list is \(a_1, a_2, \ldots, a_n\), then you must ensure that \(a_1 \le a_2 \le \ldots \le a_n\). Note that the list may contain duplicate widths.
The problem requires you to read from standard input and write the sorted list to standard output.
inputFormat
The first line of input contains an integer (n) representing the number of books. The second line contains (n) space-separated integers, each denoting the width of a book.
outputFormat
Output a single line containing the sorted list of book widths in non-decreasing order, with each number separated by a single space.## sample
7
5 3 3 2 2 8 6
2 2 3 3 5 6 8