#C13069. Filter and Sort Odd Numbers

    ID: 42566 Type: Default 1000ms 256MiB

Filter and Sort Odd Numbers

Filter and Sort Odd Numbers

You are given a list of integers. Your task is to filter out all even numbers and then sort the remaining odd numbers in ascending order. Formally, given a list \(A = [a_1, a_2, \dots, a_n]\), you need to produce a new list \(B\) such that:

\(B = \{a_i \in A \mid a_i \text{ mod } 2 \neq 0\}\)

and \(B\) is sorted in ascending order. Use standard input for reading the data and standard output for printing the result. If no odd number is found, output an empty line.

inputFormat

The first line of input contains an integer \(n\) representing the number of elements in the array. The second line contains \(n\) space-separated integers.

outputFormat

Output a single line containing the sorted odd numbers separated by a single space. If there are no odd numbers, print an empty line.

## sample
7
4 1 3 7 10 2 5
1 3 5 7