Help me in solving PREQ04 problem

My issue

give logic

My code

import java.util.*;
import java.lang.*;
import java.io.*;

class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here

	}
}

Learning course: Design and Analysis of Algorithms
Problem Link: How to accept multiple inputs in a line in Design and Analysis of Algorithms