Can anyone help me in jungle camping problem? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Can anyone help me in jungle camping problem?

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

22nd Dec 2020, 2:12 PM
Atul
Atul - avatar
7 Answers
+ 5
Use System.out.println () ; to get output
22nd Dec 2020, 3:17 PM
Aysha
Aysha - avatar
+ 4
1) You are reading and comparing entire string, means for input : "Grr Chirp Grr" Value of *n* would be "Grr Chirp Grr" and not just "Grr" which will fail all the if conditions. other minor problems include :- 2) using comparing with a "snake" and "chirp" with a lowercase "s" and "c" which will not match as input contains upper case 3) using space inappropriately, for "Lion " there is space after the word, whereas for others there is a space before.
22nd Dec 2020, 2:33 PM
Arsenic
Arsenic - avatar
+ 2
Arsenic what should be done can u please give some hint?
22nd Dec 2020, 3:10 PM
Atul
Atul - avatar
+ 2
Atul Lookup "scanner.next()" on Google for hint.
22nd Dec 2020, 3:26 PM
Arsenic
Arsenic - avatar
+ 2
Atul so you want another hint ? Here you go :- End of a word is marked by a whitespace character, And the main problem you are facing here is your code is taking entire sentence as input. Mix it with some knowledge of loops and you will be have recipie of the solution.
22nd Dec 2020, 4:14 PM
Arsenic
Arsenic - avatar
+ 1
Aysha don't send me the answers please correct only the errors
22nd Dec 2020, 3:09 PM
Atul
Atul - avatar
+ 1
Yes I know it is used to take input for strings unless a delimeter is encountered
22nd Dec 2020, 3:58 PM
Atul
Atul - avatar