We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
What is the better practice for this question?
I know the hack is to just run:
scan.nextLine()
To throw away the new line character, but surely there is a cleaner way to do this right?
At the same time, parsing inputs seems a little wasteful and a little complicated for a problem like this right?
The only things I could think of were to stick on while loops to continue picking words up until the second newline character is hit.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Java Stdin and Stdout II
You are viewing a single comment's thread. Return to all comments →
What is the better practice for this question? I know the hack is to just run: scan.nextLine() To throw away the new line character, but surely there is a cleaner way to do this right?
At the same time, parsing inputs seems a little wasteful and a little complicated for a problem like this right?
The only things I could think of were to stick on while loops to continue picking words up until the second newline character is hit.