Paralaxiom interview question

problem based on string. (easy level)