So, I am getting the right output, but I still can't complete task 4. Please tell me why. Thank you!
package com.codegym.task.task07.task0718;
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 {
//write your code here
InputStreamReader r = new InputStreamReader(System.in);
BufferedReader reader = new BufferedReader(r);
ArrayList<String> list = new ArrayList<>();
for(int i=0; i<10; i++) {
list.add(reader.readLine());
}
boolean isSorted = true;
for(int i=0; i<list.size()-1; i++) {
if (list.get(i).length() > list.get(i + 1).length()) {
isSorted = false;
System.out.println(i);
break;
}
}
}
}