#C13800. Filter Primes from Array

    ID: 43379 Type: Default 1000ms 256MiB

Filter Primes from Array

Filter Primes from Array

You are given an array of integers. Your task is to filter out the prime numbers from the array and print them in the order they appear, separated by a single space. A number (p) is considered prime if (p > 1) and its only positive divisors are (1) and (p). For example, 2, 3, and 5 are prime numbers, but 0, 1, 4, and 6 are not.

inputFormat

The first line of the input contains a single integer (n), which represents the number of elements in the array. The second line contains (n) space-separated integers representing the elements of the array.

outputFormat

Output the prime numbers from the array in the order they appear, separated by a single space. If there are no prime numbers, output an empty line.## sample

6
0 1 2 3 4 5
2 3 5