Decreasing string

http://www.codechef.com/viewsolution/6773396
please check the link above and help me fix the problem.
I am getting WA.
Thanks for your support.

//