I think the logic behind the code is good, but I still missing something....
package com.codegym.task.task07.task0711;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.*;
/*
Remove and insert
*/
public class Solution {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
ArrayList<String> list = new ArrayList<String>();
for(int i=0; i<5; i++){
list.add(0, sc.nextLine());
}
int n = list.size();
for(int i=0; i<13; i++){
String temp = null;
temp = list.get(n);
list.add(0, temp);
list.remove(n);
}
for (int i = 0; i < list.size(); i++){
int j = list.size() - i - 1;
System.out.println( list.get(j) );
}
}
}