#C13078. Filter Prime Numbers
Filter Prime Numbers
Filter Prime Numbers
Given a list of integers, your task is to extract the prime numbers and output them in the same order as they appear in the input. A prime number is defined as a natural number greater than 1 that has no positive divisors other than 1 and itself. Use the (\texttt{is_prime}(n)) function logic to determine if a number is prime, and then filter out the non-prime numbers. You must read input from STDIN and write the result to STDOUT.
inputFormat
The input consists of two lines. The first line contains an integer (N) (1 (\leq N \leq 10^5)) representing the number of integers. The second line contains (N) space-separated integers. Note that negative numbers and zero are not considered prime.
outputFormat
Print the prime numbers from the input list in the order they appear, separated by a single space. If there are no prime numbers, output an empty line.## sample
9
2 3 4 5 6 7 8 9 10
2 3 5 7
</p>