wrong answer in compilers and parsers......

why this code gives wrong answer…can anyone plz provide testcases for which this code is wrong…
thanks in advance…
link CodeChef: Practical coding for everyone