ArrayList<String> list = new ArrayList<>();
Scanner scanner = new Scanner(System.in);
int max = Integer.MIN_VALUE;
int min = Integer.MAX_VALUE;
for (int i = 0; i < 10; i++) {
list.add(scanner.next());
max = Math.max(max, list.get(i).length());
min = Math.min(min, list.get(i).length());
}
for (int i = 0; i < list.size(); i++) {
if (list.get(i).length() == max || list.get(i).length() == min){
System.out.println(list.get(i));
break;
}
}
GO TO FULL VERSION