Filtering the list

Report a typo

Write a program that reads a list of integer numbers separated by spaces from the standard input and then removes all numbers with even indexes (0, 2, 4, and so on).

After that, the program should output the resulting sequence in reverse order.

Sample Input 1:

1 2 3 4 5 6 7

Sample Output 1:

6 4 2

Sample Input 2:

1 2

Sample Output 2:

2

Sample Input 3:

7 6 -5 -4 -3 2 1

Sample Output 3:

2 -4 6
Write a program in Java 17
class Main {
public static void main(String[] args) {
// put your code here
}
}
___

Create a free account to access the full topic