Hi there,
I am trying to get the words (city names) from a user input. For example, the inputs:
String input1 = "Pyeongchang 135135.13 531.351"; //Note: "Pyeongchang" is of one word.
String input2 = "New York 3543.25 25352.523532"; //Note: "New York" is of two words.
I need to be most efficient, time wise.
At this stage, I am only able to get a one-word city by doing this:
Scanner s = new Scanner(System.in); //These input would be like input1 and input2, shown above.
String cityName = s.next(); //This only works for one-worded cities like Pyeongchang, but not for >1 worded cities.
How would you change the code so that it reads the names of any lengths, and be most efficient?
Cheers.