A question from spoj

QUESTION LINK

and MY SOLUTION

WHY AM I GETTING WA???

//