PRFXGD unexpected behaviour
can anyone explain whats wrong with my solution of good prefix? test cases are running individually but giving answer as 0 except for the first test case which runs fine every time. plz look as i never experienced anything like that before.

Rewrite the code with following retouch.


now its working for sample cases,that is running for all cases together instead of passing individually but still giving WA. can you explain what this retouch do?