Czy ten kod jest jak najbardziej uniwersalny? Czy coś mogłem zrobić lepiej?
package pl.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 {
strings = new ArrayList<>();
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int number = 5;
for (int i = 0; i < number; i++){
Solution.strings.add(reader.readLine());
}
int max = strings.get(0).length();
for(int i = 0; i < strings.size(); i++){
if (strings.get(i).length() > max){
max = strings.get(i).length();
}
}
for (int i = 0; i < number; i++){
if(strings.get(i).length() == max){
System.out.println(strings.get(i));
}
}
}
}