NAME2:Getting WA

In this code i am getting wrong answer even though i am getting correct output.Why i am getting WA?

question- https://www.codechef.com/problems/NAME2

solution- https://www.codechef.com/viewsolution/20438786

//