package com.codegym.task.task07.task0718; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; /* Checking the order */ public class Solution { public static void main(String[] args) throws IOException { //write your code here Scanner sc= new Scanner(System.in); ArrayList<String> list= new ArrayList<>(); for(int i=0; i<10; i++){ list.add(sc.nextLine()); } int index = 0; for (int j = 0; j < list.size(); j++) { if (list.get(j).length() > list.get(j+1).length()) { // System.out.println(index); index = j; break; } } System.out.println(index); } }