Help me in solving JBR14 problem

My issue

Learning course: Learn Advance Java
Problem Link: CodeChef: Practical coding for everyone