wa in decreasing string

http://www.codechef.com/viewsolution/4400810