даже если равные строки вводить, все равно выводит верно
package com.javarush.task.task07.task0708;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
/*
Самая длинная строка
*/
public class Solution {
private static ArrayList<String> strings;
public static void main(String[] args) throws Exception {
//напишите тут ваш код
strings = new ArrayList<String>();
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String max = null;
for(int i = 0; i<5;i++){
String s = reader.readLine();
strings.add(s);
}
for(int b = 1; b < 5;b++){
if(strings.get(b).length() > strings.get(b-1).length()){
max = strings.get(b);
}
}
for(int d = 0; d<strings.size();d++){
if(strings.get(d).length() == max.length()){
System.out.println(strings.get(d));
}
}
}
}