Harbinger Group interview question

Write code for substring finding