getting correct answer still not satisfying 4th condition
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> s=new ArrayList<>();
for(int i=0;i<10;i++)
{
s.add(reader.readLine());
}
for(int i=0;i<s.size();i++)
{
if((s.get(i).length())>(s.get(i+1).length()))
{
System.out.println(s.indexOf(s.get(i)));
break;
}
}
}
}