I can't understend what is wrong.
package com.codegym.task.task07.task0708;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
public class Solution {
private static List<String> strings;
public static void main(String[] args) throws Exception
{
BufferedReader reader = new BufferedReader( new InputStreamReader(System.in));
ArrayList<String> list = new ArrayList<String>();
strings =new ArrayList<String>();
for (int i = 0; i < 5; i++)
{
String s = reader.readLine();
strings.add(s);
}
// Display the contents of the collection
int max =strings.get(0).length();
list.add(strings.get(0));
for (int i = 1; i < strings.size(); i++)
{
if(max < strings.get(i).length())
{
max=strings.get(i).length();
list.add(strings.get(i));
list.remove(0);
}
else if(max == strings.get(i).length())
{
list.add(strings.get(i));
}
}
for (int j = 0; j < list.size(); j++)
{
System.out.println( list.get(j) );
}
}
}