NZEC IN PALIN. Need Help

This post was flagged by the community and is temporarily hidden.

You are getting a NumberFormatException.

The input number can be of ~1000000 digits. Such HUGE numbers are clearly out of the range of numbers representable by a long in Java.

So, the line long num=Long.parseLong(br.readLine().trim()); throws a NumberFormatException.

This post was flagged by the community and is temporarily hidden.

Just adding a throws NumberFormatException clause does not mean that you will not get it again.

Try entering a larger number, like 10000000000000000000000000000000000000000 and see what happens. this is only 41 digits. Now, imagine what happens when there are ~1000000 digits.

You need to handle the big numbers in special ways.