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