+ 2
Can anyone help me in jungle camping problem?
7 Réponses
+ 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.
+ 2
Arsenic what should be done can u please give some hint?
+ 2
Atul
Lookup "scanner.next()" on Google for hint.
+ 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.
+ 1
Aysha don't send me the answers please correct only the errors
+ 1
Yes I know it is used to take input for strings unless a delimeter is encountered