Hey, can anyone tell me why my solution can't pass 4th requirement?
Thanks for help.
package pl.codegym.task.task07.task0718;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
/*
Sprawdzanie kolejności
*/
public class Solution {
public static void main(String[] args) throws IOException {
//tutaj wpisz swój kod
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
ArrayList<String> list = new ArrayList<String>();
for (String s = reader.readLine(); !(s.isEmpty()); s = reader.readLine()){
list.add(s);
}
for (int i = 1; i < list.size(); i++) {
if (list.get(i).length() < list.get(i - 1).length()) {
System.out.println(i);
break;
}
}
}
}