Looking at it, it seems fine but the output is all weird. I don't understand what I did wrong.
package com.codegym.task.task07.task0711;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
/*
Remove and insert
*/
public class Solution {
public static void main(String[] args) throws Exception {
//write your code here
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
ArrayList<String> list = new ArrayList<String>();
String g = " ";
for(int i = 0; i < 5; i++) {
list.add(0, reader.readLine());
}
for(int j = 0; j < 13; j++) {
g = list.get(j);
list.remove(4);
list.add(0, g);
}
for(int a = 0; a < 5; a++) {
System.out.println( list.get(a) );
}
}
}