The code won't verify, even though it works. Could someone take a look?
package com.codegym.task.task07.task0718;
import org.w3c.dom.ls.LSOutput;
import javax.crypto.spec.PSource;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
/*
Checking the order
*/
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 word = reader.readLine();
list.add(word);
}
for (int i = 0; i < list.size() - 1; i++) {
int current = list.get(i).length();
for (int j = i + 1; j < list.size(); j++) {
int next = list.get(j).length();
if (current > next) {
System.out.println(i);
return;
}
}
}
}
}