Solution Of Compilers and Parsers

Hi,
https://www.codechef.com/viewsolution/34858863 this is my solution for the compilers problem of week 2 of DSA Learning Series. Can someone point out the mistake in my approach? I feel like my logic is correct but for some reason, it is not accepting my solution.