Code Incoginito- Shibu and String Game

in the event CODE INCOGINITO There is a question “shibu and string game” the given test case is passed in my Interpreter .can any one help me in finding error in my code.also pls mention any test case where i am getting wrong.i tryed in two ways .pls check where it is getting wrong

My Solution Link:
CodeChef: Practical coding for everyone

I’m almost certain the test case answers for this problem are wrong. @admin I would appreciate review of this. See also my answer here: https://discuss.codechef.com/questions/135666/code-incognito-discussion?page=1#135670