Buggy input in ANKPAREN

During the cook59 competition I kept getting NZEC but I couldn’t understand why. I verified my answers for all possible input strings up to length 12, and thousands of random input strings up to max length. Here is my code, it uses the same method as the official solution.

After the competition I found the problem: when I read the input I have to say:

String s = scan.next();

instead of

String s = scan.nextLine();

I always use nextLine() in CodeChef competitions, and both cases work on the sample input. This means my answer was correct but failed due to bad input. This is very disappointing. :frowning:

Here is someone else with the same problem.

Would the admins consider rejudging the problem (or just people that failed due to NZEC) with input that matches the sample input?


We are investigating the issue. We will rejudge the problem as soon as we confirm this. We are really sorry for the situation.