Amazon interview question

Algorithm and problem solving question about strings