public class Solution { public static void main(String[] args) throws IOException { ArrayList<String> myList = new ArrayList<String>(); BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); String s; int i=0; for (i=0;i<10;i++){ s = reader.readLine(); myList.add(s); } int longS = myList.get(0).length(); for (i=1;i<10;i++){ if (myList.get(i).length() < longS){ System.out.println(i); break; } } } }