Stub generator for nested loops in Java

I just tried to update the input generator for Bingo! (right now it isn’t even reading all the input):

read n:int
loop n loop 5 loopline 5 bn:int
read calls:string(1024)
write answer

This is the Java code that I get:

        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < 5; j++) {
                for (int k = 0; k < 5; k++) {
                    int bn = in.nextInt();
                }
                in.nextLine();
            }
            in.nextLine();
        }
        in.nextLine();
        String calls = in.nextLine();

As you can see, there appear multiple in.nextLine(), while there should only be one.

2 Likes