So I came up with this code but I really got no idea what part is messing it up. Spent over a day with several breaks tryna crack it but can't.
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 {
ArrayList<String> list = new ArrayList<String>();
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
for (int i = 0; i < 10; i++){
list.add(br.readLine());
}
int ind = 0;
String t1;
String t2;
for (int i = 1; i < 10; i++){
t1 = list.get(i - 1);
t2 = list.get(i);
if (t1.length() >= t2.length())
ind = list.indexOf(t2);
break;
}
if (ind != 0)
System.out.println(ind);
}
}