There's nothing wrong in my opinion but the output is definitely not correct = 0,idk why
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
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
ArrayList<String> list = new ArrayList<String>();
for(int i = 0 ; i <10 ; i ++){
list.add((reader.readLine()));
}
int i = 0;
while( list.get(i).length() < list.get(i+1).length()){
i++;
}
if(i != 10){
System.out.println(i);
}
}
}