Не могу понять потому что с 3 всё в порядке.
package com.javarush.task.task07.task0712;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
/*
Самые-самые
*/
public class Solution {
public static void main(String[] args) throws IOException {
//напишите тут ваш код
ArrayList<String> list = new ArrayList<>();
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int min = 0;
int max = 0;
boolean lockOne = true;
boolean lockTwo = true;
String minword = ".....................................................";
String maxword = "";
String line = "";
for (int i = 0; i < 10; i++) {
list.add(reader.readLine());
}
for (int k = 0; k < list.size(); k++) {
line = list.get(k);
if (line.length() < minword.length()) {
minword = line;
if (lockOne == true) {
min = k;
lockOne = false;
}
}
if (line.length() > maxword.length()) {
maxword = line;
if (lockTwo == true) {
max = k;
lockTwo = false;
}
}
}
// System.out.println(min);
// System.out.println(max);
// System.out.println(minword);
// System.out.println(maxword);
if (max - min > 0) {
System.out.println(maxword);
} else {
System.out.println(minword);
}
}
}