0

Having a problem in jungle camping (code coach)

https://code.sololearn.com/cu57AGScoePH/?ref=app

4th Feb 2020, 4:56 PM
R Biswas
6 Respostas
+ 2
You can take the input as complete string. Each sound is space separated. So you can use .split(" "). String s = input.nextLine(); String[] sounds = s.split(" "); Now you can use a loop.
5th Feb 2020, 5:56 PM
Denise Roßberg
Denise Roßberg - avatar
+ 3
Using compareTo() is correct in this case, as you are comparing the letters of the String lexicographically. However, the compareTo() method returns an int not a boolean. So you need to use "compareTo(s1) == 0".
4th Feb 2020, 6:30 PM
ChaoticDawg
ChaoticDawg - avatar
+ 2
You will not only getting 3 sounds. Sometimes you will get more, sometimes less. Sometimes you are using compareTo() instead of equals()
4th Feb 2020, 6:11 PM
Denise Roßberg
Denise Roßberg - avatar
+ 1
Denise Roßberg Thanks a lot, it's solved
6th Feb 2020, 5:32 AM
R Biswas
0
Denise Roßberg how will I take variable no. of sounds? Also I have a problem in no numerals (another post)
5th Feb 2020, 5:49 PM
R Biswas
0
s pal Your welcome :)
6th Feb 2020, 2:12 PM
Denise Roßberg
Denise Roßberg - avatar