Pergunta de entrevista da empresa Bloomberg

Given a string, find the longest contiguous sequence of strings without using additional memory; one or two variables are fine. Pick any one if a tie. e.g. sbcsdfaaiwer; ans: aa