The output is correct but still the conditions are incorrect. Any help?
package fr.codegym.task.task07.task0708;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
/*
La chaîne la plus longue
*/
public class Solution {
private static List<String> chaines;
public static void main(String[] args) throws Exception {
chaines = new ArrayList<String>();
int length = 0;
int size = 0;
for(int i = 0; i < 5; i++){
BufferedReader reader = new BufferedReader(new InputStreamReader (System.in));
String s = reader.readLine();
chaines.add(s);
length= chaines.get(0).length();}
for ( int y = 4; y >=0; y--){
size = chaines.get(0).length();}
if (size > length)
{
System.out.println(size);
}
else
if(size == length)
{
System.out.println(size);
System.out.println(length);
}
else {
System.out.println(length);
}
//écris ton code ici
}
}