вот текст
public class Solution {

private static ArrayList<String> strings = new ArrayList<String>();
    public static void main(String[] args) throws Exception {

        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
ArrayList <String> strings = new ArrayList<String>(5);

int max=0;
for (int i = 0; i < 5; i++) {
String s = reader.readLine();
strings.add(s);


if (strings.get(i).length()>max) {
max=strings.get(i).length();
}
}
for (int i = 0; i < strings.size(); i++) {
if (max==strings.get(i).length()) {
System.out.println(strings.get(i));
}
}}}