Scanner question

Scanner question

So they want us to do this:

input:


Hello world this is monika

expected output:


Hello world this is monika

2nd input:


one two three four five

expected 2nd output:


one two three four five

My code:


 val scanner = Scanner(System.`in`) val s1 = scanner.next() val s2 = scanner.next() val s3 = scanner.next() val s4 = scanner.next() val s5 = scanner.next() println(s1) println(s2) println(s3) println(s4) println(s5) val s6 = scanner.next() val s7 = scanner.next() val s8 = scanner.next() val s9 = scanner.next() val s10 = scanner.next() println(s6) println(s7) println(s8) println(s9) println(s10) }

Its wrong, i have no idea why, i have been trying to solve it for an hour

submitted by /u/sudolake
[link] [comments]