I am displaying the index number of the element which is violating the order. How else should I complete the task to make the verifier accept the answer? Is my understanding of the task wrong?
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 input = new BufferedReader(new InputStreamReader(System.in));
ArrayList<String> list = new ArrayList<String>();
int stringLength = 0;
String s;
for (int x = 0; x < 10; x++) {
s = input.readLine();
list.add(s);
if (x == 0) {
stringLength = s.length();
}
else if (s.length() < stringLength) {
System.out.println(x);
break;
}
}
}
}