Not sure exactly why this is messing up. Probably something simple? Thank you.
package com.codegym.task.task07.task0718;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.*;
/*
Checking the order
*/
public class Solution {
public static void main(String[] args) throws IOException {
Scanner scnr = new Scanner(System.in);
ArrayList<String> list = new ArrayList<>();
for(int i = 0; i<10; i++){
list.add(scnr.nextLine());
}
int index = 0;
int a =0;
int b = 0;
for(int i=0; i<=list.size() - 1; i++){
a = list.get(i).length();
b = list.get(i+1).length();
if(a>b){
index = i;
break;
}
}
System.out.println(index);
}
}