#C9952. Process List Operations

    ID: 54102 Type: Default 1000ms 256MiB

Process List Operations

Process List Operations

You are given a list of integers and a series of operations to perform on this list. The operations are applied in the order they are given. The available operations are:

  • remove_even: Remove all even numbers from the list.
  • keep_prime: Keep only the prime numbers in the list. A number \( n \) is prime if \( n > 1 \) and has no divisors other than 1 and itself.
  • reverse: Reverse the order of the list.
  • sort_asc: Sort the list in ascending order.
  • sort_desc: Sort the list in descending order.

Your task is to implement a program that reads a list of integers and a set of operations from standard input, applies the operations in order and outputs the resulting list to standard output. The output list should be printed as space-separated integers.

inputFormat

The input consists of two lines:

  1. The first line contains a sequence of space-separated integers representing the list.
  2. The second line contains a sequence of space-separated strings representing the operations to be applied. If there are no operations, the second line will be empty.

outputFormat

Output the resulting list after applying all operations. The integers should be printed in order, separated by a single space.

## sample
1 2 3 4 5 6
remove_even
1 3 5