В чем ошибка?
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 {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
ArrayList<String> list = new ArrayList<>();
for(int i = 0; i < 10; i++) {
String s = reader.readLine();
list.add(s);
}
int min = list.get(0).length();
for(int j = 0; j < 5; j++){
if(min >= list.get(j).length()) {
min = list.get(j).length();
}
}
int max = list.get(0).length();
for(int h = 0; h < 5; h++){
if(max <= list.get(h).length()) {
max = list.get(h).length();
}
}
int x = 0;
for(int k = 0; k < 5; k++) {
if(list.get(k) == min || list.get(k) == max) {
x = list.get(k);
break;
}
}
for(int g = 0; g < list.size(); g++) {
System.out.println(x);
}
}
}