Compiler problem

Can someone tell me why this solution is wrong for the compiler problem?

https://www.codechef.com/submit/COMPILER

https://www.codechef.com/viewsolution/24588289

I modified the solution but still I am getting wrong answer while submitting

https://www.codechef.com/viewsolution/24589027