title: Scanner not reading the last line
body: <p>I have this piece of code and my problem is that the Scanner is not picking up the last line unless I hit the <kbd>Enter</kbd> key.</p>
  
  <p>I have already tried all answers available but had no luck. I can not use <code>BufferedReader</code>, I have to do this using <code>Scanner</code> only.</p>
  
  <pre><code>Scanner scanner = new Scanner(System.in);
  int noOfCases = scanner.nextInt();
  scanner.nextLine();                  //consuming the left out \n
  for (int i = 1; i &lt;= noOfCases; i++) {
      int count = 0;
      String line = scanner.nextLine();
      String arr[] = line.split(" ");
      int white = Integer.parseInt(arr[0]);
      int red = Integer.parseInt(arr[1]);
      int green = Integer.parseInt(arr[2]);
  
      if (white &gt; 0 &amp;&amp; red &gt; 0 &amp;&amp; green &gt; 0) {
          count = count + (white / 3) + (red / 3) + (green / 3);
          white = white - ((white / 3) * 3);
          red = red - ((red / 3) * 3);
          green = green - ((green / 3) * 3);
      }
      int minVal = Math.min(Math.min(white, red), green);
      count = count + minVal;
  
      System.out.println(count);
  }
  </code></pre>
  
  <p>The above code is not reading the last line, passing the input is not in my hands.</p>
  
  <p>The sample input is like (no. of test cases followed by the test cases):</p>
  
  <pre><code>3        // no of test cases
  5 5 5
  10 4 2
  4 4 4
  </code></pre>