Help me in solving LB02B problem

My issue

Now that we have understood the problem statement, let us write down a few more sample cases or examples.
Review the sample input / output given in the table below.

Sample 1:
Input
Output
8 sample inputs
2 3 4
2 3 5
2 3 6
2 3 7
2 3 8
2 3 9
2 3 10
2 3 11
8 sample inputs
CHICKEN
NONE
ANY
NONE
CHICKEN
DUCK
CHICKEN
NONE

solution in java

Learning course: Java for problem solving - 1
Problem Link: CodeChef: Practical coding for everyone