what the problem with the last point the program display in reverse order.
package com.codegym.task.task07.task0714;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;
/*
Words in reverse
*/
public class Solution {
public static void main(String[] args) throws Exception {
//write your code here
ArrayList<String> list = new ArrayList<String>(Arrays.asList("marwan"));
Scanner read = new Scanner(System.in);
for (int i = 0; i<5 ; i++){
list.add(read.nextLine());
}
list.remove(2);
Collections.reverse(list);
for(int a = 0; a<list.size() ; a++){
System.out.println(list.get(a));
}
}
}