Solved a problem, got the correct answer for multiple test cases

CodeChef: Practical coding for everyone here is the link of the code of a problem. tried multiple test cases but got a wrong answer. please help if someone knows a fix.

I didn’t go through your implementation but you might be getting wrong answer because at the end you are printing the final answer like “case1:” but the correct method is “Case 1:”. So look into it. Thank you.

look for the way they have asked you to output its Case 1: and moreover i think your algo will give Time Limit Error