#K5991. Longest Prime Subsequence
Longest Prime Subsequence
Longest Prime Subsequence
You are given an array of integers. Your task is to extract the subsequence of prime numbers from the array, preserving their original order. A prime number is defined as an integer \( n > 1 \) that has no positive divisors other than 1 and itself.
If there are no prime numbers in the array, output an empty line.
Note: The input will be provided via standard input and the output should be written to standard output.
inputFormat
The first line of input contains a single integer \( n \) representing the number of elements in the array. The second line contains \( n \) space-separated integers representing the array elements.
outputFormat
Print the prime numbers from the array in the order they appear, separated by a single space. If there are no prime numbers, print an empty line.
## sample10
1 3 5 4 9 11 13 6 7 17
3 5 11 13 7 17