Class Assignment Doubt

When i’m giving input with one testcase the output is correct but for multiple testcases the ouput is not correct.

Code : https://ide.codingblocks.com/s/577023

Your logic is correct but you have made an error while calculating the count.
You need to reset the count variable for every test case.
Try fixing that and pay attention to the requested output format.

Code : https://ide.codingblocks.com/s/577172

Done with the changes as mentioned by you.
only the sample test case is passed.
other test cases are not passed.

You have an error in output format

Try correcting line number 12

System.out.println("#" + n + " " + ":" + " " + res);

You are printing the value of n whereas we need to print the testcase number ie. (i+1) rather than n.

Got it. All Testcases passed.
Thanks @Mihir.sood

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.