This post was flagged by the community and is temporarily hidden.
I can’t seem to figure out the reason for NZEC, but I guess it’s due to the excessive memory your program uses, check here : http://www.spoj.com/ranks/ABCPATH/lang=JAVA
All the accepted JAVA solutions are within the memory limit of 256 MB, while your solution takes around 380 MB, I’d suggest changing your approach of taking string input or changing your programming language to C, C++. JAVA has a substantial overhead of around 178 MB due to its libraries which also makes it a little slow.
However, this problem doesn’t require large amount of memory as the constraints are very small.
Hope it helps.
@codegagu : Did my suggestion help? If so, kindly upvote it, if not please elaborate the new problems you are facing.