Не могу понять, почему задача не может пройти проверку. Перепроверяла разные части кода, работа была корректной. Но почему-то не принимает
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));
String s;
ArrayList<String> strings = new ArrayList<String>();
int minIndex=0, maxIndex=0, minLenght, maxLenght;
for (int i=0; i<10; i++){
s = reader.readLine();
strings.add(s);
}
minLenght = maxLenght = strings.get(0).length();
for (int i=strings.size()-1; i>0; i--){
if(strings.get(i).length()>=maxLenght) {
maxLenght = strings.get(i).length();
maxIndex = i;
}
if(strings.get(i).length()<=minLenght) {
minLenght = strings.get(i).length();
minIndex = i;
}
}
System.out.println(maxIndex<minIndex?strings.get(maxIndex):strings.get(minIndex));
}
}