String Problem

I am trying to solve this vpalin ,But i am unable to frame the idea,would anyone like to help me frame the idea to solve this problem ?