Getting RE in only one testcase in CONTAIN , rest all AC , why?

Problem CONTAIN
https://www.codechef.com/viewsolution/34142369
Please help !