Input space separated string

How to input 2 space separated strings in loop .
when I use -
String[] str=s.nextLine().split(" ");
in loop, the nextline character is ignored and it gives no such element exception when the loop iterates second time.

I want to input multiple such pairs of strings

Since there are exact 2 inputs in a line you are use s.next() to input 1 string at a time.

Didn’t get it. If I use s.next() then only the first word will be read and the next space separated word will be ignored.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.