Substring Minimum Function SUBMIMX

Where is my solution wrong? Just tell the case where it fails. It would be a great help!
https://www.codechef.com/viewsolution/54371684
Thanks…