Java BufferedReader - 输出的最后一行不会自动读取,它只在我按下 enter 时读取

Java BufferedReader - the last line of output isn't read automatically, it reads only when i press enter

这是我的代码:

public class hack 
{
    public static void main(String[] args) throws IOException
    {
        BufferedReader sc = new  BufferedReader(new InputStreamReader(System.in));
        int count = 0;
        int cases = Integer.parseInt(sc.readLine());
        String pie = "31415926535897932384626433833";
        String str;
        for(int i = 0; i < cases; i++)
        {
            str = sc.readLine();
            String []strarr = str.split(" ");
            String str1 = "";
            for(int k = 0; k < strarr.length; k++)
            {
                char check[] = strarr[k].toCharArray();
                count = 0;
                for(int j = 0; j < strarr[k].length(); j++)
                {
                    if((check[j] > 64 && check[j] < 91) || (check[j] > 96 && check[j] < 122))
                    {
                        count++;
                    }
                }
                str1 = str1 + count;
            }
            if(str1.equalsIgnoreCase(pie.substring(0,strarr.length)))
            {
                System.out.println("It's a pi song.");
            }
            else
            {
               System.out.println("It's not a pi song.");
            }
        }
    }
}

输入文件如下:

4<br>
dHjVPihCZ BjHi OkWbQBH NIQM Ue BPIJHS ZdWQLMIxy wzVGBhx GqQjKMeJ ZmfZo l qmDWBUrs<br>
YkoGQTJYN vgy tJ k B g YV T iXExLPfFk eL TTcOtic MRbmKE<br>
RMSIYuD GiRYQ U K THGUT XYycRULD pTG NqlHUO RFEG rJ sqcGVd jZ IhTlGUvE FLQfISMqN cW<br>
Rzm YPPGEQDXq PsDpNLCd qLTFiFDn wFqpGvSB YQqIZY sfWRwGJ<br><br>

输出结果如下:

dHjVPihCZ BjHi OkWbQBH NIQM Ue BPIJHS ZdWQLMIxy wzVGBhx GqQjKMeJ ZmfZo l qmDWBUrs<br>
YkoGQTJYN vgy tJ k B g YV T iXExLPfFk eL TTcOtic MRbmKE<br>
RMSIYuD GiRYQ U K THGUT XYycRULD pTG NqlHUO RFEG rJ sqcGVd jZ IhTlGUvE FLQfISMqN cW<br>
It's not a pi song.<br>
It's not a pi song.<br>
It's not a pi song.<br>
Rzm YPPGEQDXq PsDpNLCd qLTFiFDn wFqpGvSB YQqIZY sfWRwGJ<br>
it's not a pi song.
<br><br>

在这里我给了4个作为否。个案。作为输入,我把所有四行放在一起,但它只考虑前三行作为输入,只有它们的输出一起显示,我希望所有四行的输出一起显示。

您需要在最后一行输入之后再换行。 BufferedReader.readLine() javadoc:

Reads a line of text. A line is considered to be terminated by any one of a line feed ('\n'), a carriage return ('\r'), or a carriage return followed immediately by a linefeed.