I think Input#skip should be sufficient without the while loop.