I'm getting an NZEC for this particular problem http://www.spoj.com/problems/ABCPATH/
My code works correctly for the test case stated in the problem though. Here is my work: http://ideone.com/fXLM6u
Since i can't figure out what might have caused an NZEC,it would be extremely helpful if anyone could figure it out and let me know the reason behind it. Thank You.