0

Given the code:

Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
String s1 = sc.nextLine();
String s2 = sc.nextLine();

And the input:

2
heads are better than
1 head

The output will be:

n="2"
s1=""
s2="heads are better than"

And my question is how to make the desired output to be:

n="2"
s1="heads are better than"
s2="1 head"
Elarbi Mohamed Aymen
  • 1,480
  • 1
  • 11
  • 25

0 Answers0