Help me in solving JBR21 problem

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

My issue