Can someone help me find out what I did wrong here?
package com.codegym.task.task07.task0708;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
/*
Longest string
*/
public class Solution {
private static List<String> strings;
public static void main(String[] args) throws Exception {
//write your code here
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
strings = new ArrayList<String>();
for(int i = 0; i<5; i++){
strings.add(reader.readLine());
}
ArrayList<String> l = new ArrayList<String>();
l.add(strings.get(0));
for(int j = 1; j<strings.size();j++){
if(strings.get(j).length() > l.get(0).length() ){
l.set(0,strings.get(j));
}
else if(strings.get(j).length() == l.get(0).length()){
l.add(strings.get(j));
}
}
for(int k =1; k<l.size(); k++){
if (l.get(k).length() < l.get(0).length()){
l.remove(k);
}
}
for (String s : l) {
System.out.println(s);
}
}
}