textroll/Textroll.java
1
2
3
4
5 import java.io.*;
6 import java.util.Scanner;
7 import java.util.*;
8
9 public final class Textroll {
10
11 private static final Scanner STDIN =
12 new Scanner (new BufferedInputStream (System.in));
13
14 private static final PrintStream STDOUT =
15 new PrintStream (new BufferedOutputStream (System.out));
16
17
18 public static void main (final String[] args) {
19 input: for (int ds=1; ; ds++) {
20 final int n = STDIN.nextInt();
21 if (n==0) break;
22 STDIN.nextLine();
23 assert 0 < n && n <= 1_000;
24
25
26 int ball = 1;
27 for (int i=0; i<n; i++) {
28 final char[] text = STDIN.nextLine().toCharArray();
29 assert 0 < text.length && text.length <= 100;
30 while (ball<=text.length && text[ball-1]!= ' ') ball++;
31 }
32 STDOUT.println (ball);
33 }
34 STDOUT.close();
35 }
36 }
37
38
39
40
41
42
43