+ 1

Is there anyone kind enough to tell what's wrong with my Java code?

https://code.sololearn.com/cv4SzViREzJ3/?ref=app I think I failed at splitting input into an array.. but I can't find what's wrong with my code. I already solved Balconies and Ballpark orders with split, so I just applied the same split code in this case, too. I'll appreciate any comments!!

4th Nov 2022, 2:07 AM
이참치
이참치 - avatar
3 Answers
+ 3
Instead of input.next() try: input.nextLine();
4th Nov 2022, 4:47 AM
Tibor Santa
Tibor Santa - avatar
+ 3
And you should move the final if statement after the for loop
4th Nov 2022, 4:49 AM
Tibor Santa
Tibor Santa - avatar
+ 2
thank you so much!!! I changed input.next() into input.nextLine() and moved if statement and then it worked!!!
4th Nov 2022, 5:05 AM
이참치
이참치 - avatar