XYSTR- June Long Challenge

CodeChef: Practical coding for everyone. Can you please tell why the code is giving a WA? It is passing all the test cases I have tried manually. Please provide the test case where it fails. Thanks