#C13136. Filter and Reverse Prime Numbers
Filter and Reverse Prime Numbers
Filter and Reverse Prime Numbers
You are given a list of integers. Your task is to filter out the prime numbers from the list and then output them in the reverse order of their appearance. A prime number is a number that is greater than 1 and has no divisors other than 1 and itself. The answer should be printed as a single line with the numbers separated by a space. If there are no prime numbers in the list, output an empty line.
Note: The input is provided as a single line of space-separated integers.
inputFormat
The input consists of a single line containing space separated integers. The list may be empty or contain negative numbers as well. Your program should read the integers from stdin.
outputFormat
Output the prime numbers found in the input list in reversed order, separated by a single space in one line. If no prime number is found, output an empty line.
## sample3 6 10 29 18 19
19 29 3