Can someone help me debug this code, getting WA (RICHSTR)

solution link
problem link