The string question is tough

i am trying to solve this question but i not able to find the solution fot it