package Chapter01.Section01;

import edu.princeton.cs.algs4.StdIn;
import java.util.ArrayList;

public class Exercise21
{
    public static void main(String[] args)
    {
        String[] lines = getStdInLines();
        printLines(lines);
    }

    public static void printLines(String[] lines)
    {
        for(String line : lines)
        {
            String[] split = line.split(" ");
            if (split.length == 3)
            {
                String name = split[0];
                int recorded = Integer.parseInt(split[1]);
                int possible = Integer.parseInt(split[2]);
                double percentage = (double)recorded / possible;

                System.out.printf("%10s %4d %4d %10.3f%n",
                    name,
                    recorded,
                    possible,
                    percentage);
            }
        }
    }

    public static String[] getStdInLines()
    {
        ArrayList<String> lines = new ArrayList<String>();

        while(StdIn.hasNextLine())
        {
            String curLine = StdIn.readLine();
            lines.add(curLine);
        }

        return lines.toArray(new String[0]);
    }
}

@@ -189,24 +189,29 @@
 lines = 
-get
 StdIn
+.readAll
 Lines();
@@ -874,303 +874,7 @@
    %7D
-%0A%0A    public static String%5B%5D getStdInLines()%0A    %7B%0A        ArrayList%3CString%3E lines = new ArrayList%3CString%3E();%0A%0A        while(StdIn.hasNextLine())%0A        %7B%0A            String curLine = StdIn.readLine();%0A            lines.add(curLine);%0A        %7D%0A%0A        return lines.toArray(new String%5B0%5D);%0A    %7D
 %0A%7D%0A

Use StdIn's readAllLines() method