task07.task0708.
I don't exactly know what is wrong with my code here. Output is good but conditions are not met.
package pl.codegym.task.task07.task0708;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
/*
Najdłuższy ciąg
*/
public class Solution {
private static List<String> strings;
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
ArrayList<String> lista = new ArrayList<String>();
int max = 0;
for(int i = 0; i < 5; i++)
{
lista.add(br.readLine());
if(lista.get(i).length() > max)
{
max = lista.get(i).length();
}
}
for(int j = 0; j < lista.size(); j++)
{
if(lista.get(j).length() == max)
{
System.out.println(lista.get(j));
}
}
// System.out.println(lista);
}
}